-
-
Save maricris-sn/7c2974b077a11d1c250c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gibbon = Gibbon::API.new | |
view = ActionView::Base.new('app/views/', {instance_variable_for_templates: 5324}, ActionController::Base.new) | |
campaign = gibbon.campaigns.create( | |
type: "regular", | |
options: { | |
list_id: 'xxxy', | |
from_email: '[email protected]', | |
from_name: 'Your From', | |
subject: "the subject", | |
template_id: 128128398 | |
}, | |
content: { | |
sections: { | |
template_html: view.render(partial: 'mailchimp/template_html'), | |
footer_or_whatever: view.render(partial: 'mailchimp/footer_or_whatever') | |
} | |
} | |
) | |
gibbon.campaigns.send(cid: campaign['id']) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- create a 'code your own' template --> | |
<!-- drag & drop / WYSIWYG templates made by mailchimp don't support adding mc:edit blocks --> | |
<!-- the WYSIWYG editor can only be used by campaigns created through the mailchimp.com GUI, not via the API --> | |
<html> | |
<div mc:edit='template_html'>placeholder text</div> | |
<div mc:edit='footer_or_whatever'>placeholder text that only appears when footer_or_whatever is not provided (or in preview mode) </div> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment