0.0
No release in over a year
API wrapper for Salesforce Marketing Cloud's Transactional and Triggered Send APIs
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 3.11.0, >= 3.11.0
~> 3.18.1, >= 3.18.1

Runtime

~> 0.20, >= 0.20
 Project Readme

Salesforce Marketing Cloud (SFMC) Email Client for Ruby

Supports sending both transactional & triggered send (marketing) emails

How to use

Config

# config/initializers/sfmc.rb

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'] # optional
)

Transactional Emails

SFMC::Transactional::Email.send_email(
  email: 'email_name',
  to: 'example@example.com',
  params: { # Each attribute should be present in the corresponding data extension in SFMC
    First_Name: "Bob",
  }
)

Triggered Send Emails

SFMC::Triggered::Email.send_email(
  email: 'email_name',
  to: 'example@example.com',
  params: { # Each attribute should be present in the corresponding data extension in SFMC
    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'] # optional
)