amro / gibbon

Gibbon is an API wrapper for MailChimp's API
https://github.com/amro/gibbon
MIT License
1.07k stars 165 forks source link

How to send campaign emails to some specific users? #299

Open Nishi1 opened 4 years ago

Nishi1 commented 4 years ago

I am able to send emails to all users using gibbon.campaigns(campaign_id).actions.send.create Can somebody tell me how to send custom created email campaign to some specific user email addresses?

mattbatman commented 4 years ago

I'm trying to work through the same thing, I think. I'd like to make a POST request to https://xxx.api.mailchimp.com/3.0/automations/xxx/emails/xxx/queue. Even though this sends a specific email from a campaign to a specific user, all the language is different.

This seems to work for me with Gibbon:

# first, add the user to the list
gibbon.lists(list_id).members.create(body: {
    email_address: email_address_from_form,
    status: "subscribed"
})

# next, send the campaign email
gibbon.automations(automation_id).emails(email_id).queue.create(body: {
    email_address: email_address_form_form
})