sachin
sachin

Reputation: 163

Send bulk Email with mailchimp

I need to send promotional email and fetch there corresponding stats.Currently i am using Gibbon Gem but not able to create campaign through .Is there any way to create campaign and add bulk email in receiver through Gibbon Gem or there is any other Gem to work for same.I need all stat of a campaign like sent ,bounced, effective email.Which version Of Gibbon Gem should i use to create campaign and contact list through Api

Upvotes: 0

Views: 369

Answers (1)

Erik Froese
Erik Froese

Reputation: 113

Gibbon does allow you to create and trigger campaigns through the Mailchimp API v3. You have to use Gibbon version >= 2.1.3 to send campaigns, because there was a bug in the earlier versions.

Gibbon's readme file was recently updated with examples.

To create a campaign:

recipients = {
  list_id: list_id,
  segment_opts: {
    saved_segment_id: segment_id
  }
}
settings = {
  subject_line: "Subject Line",
  title: "Name of Campaign",
  from_name: "From Name",
  reply_to: "[email protected]"
}

body = {
 type: "regular",
 recipients: recipients,
 settings: settings
}

begin
  gibbon.campaigns.create(body: body)
rescue Gibbon::MailChimpError => e
  puts "Houston, we have a problem: #{e.message} - #{e.raw_body}"
end

To send a campaign:

gibbon.campaigns(campaign_id).actions.send.create

To get stats:

email_stats = gibbon.reports(campaign_id).retrieve["opens"]

Upvotes: 1

Related Questions