Salesforce Marketing Cloud (SFMC) Emailer
Supports sending both transactional & triggered send (marketing) emails
How to use
Config
SFMC::SFMCBase.init(
subdomain: 'mchf5m7e9wjxn-f2xxn6l5ul1x0q',
client_id: 'client_id',
client_secret: 'super_secret',
default_send_classification: 'Default Send Classification - 293',
default_subscriber_list: 'All Subscribers - 9136',
default_data_extension: 'C4530F44-5C72-4113-8EA0-5210C9222455',
default_bcc: ['example@example.com']
)
Transactional Emails
SFMC::Transactional::Email.send_email(
email: 'email_name',
to: 'example@example.com',
params: {
First_Name: "Bob",
}
)
Triggered Send Emails
SFMC::Triggered::Email.send_email(
email: 'email_name',
to: 'example@example.com',
params: {
First_Name: "Bob",
}
)
Note: Changes to transactional emails only take effect once its send definition is refreshed:
SFMC::Transactional::SendDefinition.refresh 'email_name'
Creating a Transactional Email Send Definition
Note: The first time an email is sent a send definition for it will be created with the default values. This definition takes about a minute to actually become active, so try sending again after that. You can also manually create a send definition using:
SFMC::Transactional::SendDefinition.create(
definition_key: 'definition_key',
customer_key: 'customer_key',
send_classification: 'send_classification',
subscriber_list: 'subscriber_list',
data_extension: 'data_extension',
bcc: ['example@example.com']
)