Invocable Actions

5 minute read
  • Invocable actions work with Salesforce Flow.
  • We provide invocable actions allowing you to:

    • Create or delete a subscriber list.
    • Add, delete or unsubscribe a contact.
    • Add, delete or unsubscribe a lead.
    • Delete an email address from a list
    • Start an import wizard.
    • Trigger a transactional email.

Invocable actions are available in our Enterprise plan. They are an advanced feature typically set up by Salesforce administrator, developers or consultants.

Invocable Actions

To use one of our invocable actions you first need to select Campaign Monitor from the category menu. Once selected all of our invocable actions will appear.

Flows are a very advanced Salesforce feature. They should be fully understood outside of our integration before using. Although we provide invocable actions we don't support flows.

Add Contact to a subscriber list

This invocable action will add a Salesforce Contact to a subscriber list.

Contact = E.g. 0033G00000F3oCrQAJ The Salesforce Contact Id.

Subscriber List Id = E.g. 8284bfc9271a9d8b1bc11aef80e9592b The subscriber list Id is not to be confused with the Salesforce subscriber list record Id - Screenshot: https://b12.d.pr/i/lqrdyA

Resubscribe = Typically should be ignored. Defaults to FALSE. If you change to TRUE this will make a record active in Campaign Monitor even if they have been unsubscribed or on the suppression list. It should be used with caution.

Direct = Calls can be made either Asynchronously (false) or Synchronously (true). Defaults to FALSE. Asynchronous calls can be handy if you are calling the method from a trigger and don't want to hold up the user or cause issues if the code fails. Synchronously can be helpful when requiring immediate feedback on whether the call worked.

Delete Contact from a subscriber list

This invocable action will delete a Salesforce Contact to a subscriber list.

Contact = The Salesforce Contact Id.
Subscriber List Id =  The subscriber list Id is not to be confused with the Salesforce susbcriber list record Id - Screenshot: https://b12.d.pr/i/lqrdyA

Unsubscribe Contact from a subscriber list

This invocable action will unsubscribe a Salesforce Contact to a subscriber list.

Contact = The Salesforce Contact Id.
Subscriber List Id =  The subscriber list Id is not to be confused with the Salesforce susbcriber list record Id -https://b12.d.pr/i/lqrdyA

Add Lead to a subscriber list

This invocable action will add a Salesforce lead to a subscriber list.

Contact = The Salesforce Lead Id.

Subscriber List Id =  The subscriber list Id is not to be confused with the Salesforce subscriber list record Id - https://b12.d.pr/i/lqrdyA

Resubscribe = Typically should be ignored and if not populated will be set to FALSE. If you change to TRUE this will make a record active in Campaign Monitor even if they have been unsubscribed or on the suppression list. It should be used with caution.

Direct = Calls can be made either Asynchronously (false) or Synchronously (true). Defaults to FALSE. Asynchronous calls can be handy if you are calling the method from a trigger and don't want to hold up the user or cause issues if the code fails. Synchronously can be helpful when requiring immediate feedback on whether the call worked.

Delete lead from a subscriber list

This invocable action will delete a Salesforce Lead to a subscriber list.

Contact = The Salesforce Lead Id.
Subscriber List Id =  The subscriber list Id is not to be confused with the Salesforce susbcriber list record Id - https://b12.d.pr/i/lqrdyA

Delete an Email address from a subscriber list

This invocable action will delete an email address from a subscriber list.
Email = An email address field.
Subscriber List Id =  The subscriber list Id is not to be confused with the Salesforce susbcriber list record Id - https://b12.d.pr/i/lqrdyA

Unsubscribe Lead from a subscriber list

This invocable action will unsubscribe a Salesforce Lead to a subscriber list.

Contact = The Salesforce Lead Id.
Subscriber List Id =  The subscriber list Id is not to be confused with the Salesforce susbcriber list record Id - https://b12.d.pr/i/lqrdyA

Start an Import wizard job

The instant import wizard invocable action allows you to start an import based on a flow. When the flow is triggered the import will start instantly. If you don't already have an import setup first Create one. Once the import is setup you will see the import ID i.e. SI-0001 take a note of this ID.

Import Id = Once an import is set you will see the Import Id i.e. SI-0001 -https://b12.d.pr/i/QSsPWe

Create Subscriber List

The create subscriber list action allows your create a new susbcriber list in Campaign Monitor based on a flow.

Client Id = This is found on the Campaign Monitor Client record in Salesforce. Specifically the Campaign Monitor Client Id - https://b12.d.pr/i/7heoOg
Confirmed Opt In = This can be True or False.
Subscriber List Name = This is the list name in Campaign Monitor.
Unsubscribe From All Lists = This can be True or False.

Confirmed Opt In = True means that when an email address is added to a list they will first be asked to confirm.

Delete Subscriber List

This action allows you to delete a subscriber list in Salesforce using a flow. Once triggered it will delete both the list and membership records in both Salesforce and then Campaign Monitor. It cannot be undone.

Subscriber List Id = This is the Salesforce record Id for the subscriber list.

You can only create or delete one subscriber list at a time using the above invocable actions.

Transactional emails

Transactional emails are quite complicated and therefore we have developed a dedicated article please see - https://www.beaufort12.com/campaignmonitor/support/transactional-emails

If you are just looking to see how to trigger the email please see - https://www.beaufort12.com/campaignmonitor/support/transactional-emails#trigger

Code Snippets

Below are some code snippets that you can use to call our invocable actions.

Add Contact to a subscriber list

The code below allows you to add a contact to a subscriber list.

wbsendit.SendItClass.runTrigger = false;
List requests = new List();
List Contacts = new List([SELECT Id, Email, HasOptedOutOfEmail FROM Contact WHERE AccountId = '0013G00000LhevIQAR' LIMIT 1000]);
for(Contact c : Contacts) {
    wbsendit.AddContactToSubscriberList.AddContactRequest req = new wbsendit.AddContactToSubscriberList.AddContactRequest();
    req.record = c;
    req.direct = true;
    req.subscriberListId = '8284bfc9271a9d8b1bc11aef80e9592b';
    requests.add(req);
}
List rtn = wbsendit.AddContactToSubscriberList.addContacts(requests);

Add lead to a subscriber list

The code below allows you to add a lead to a subscriber list.

wbsendit.SendItClass.runTrigger = false;
List requests = new List();
List leads = new List([SELECT Id, Email FROM LEAD LIMIT 10]); // Example records
for(Lead c : leads) {
    wbsendit.AddLeadToSubscriberList.AddLeadRequest req = new wbsendit.AddLeadToSubscriberList.AddLeadRequest();
    req.record = c;
    req.direct = true;
    req.subscriberListId = '8284bfc9271a9d8b1bc11aef80e9592b'; // Example list Id
    requests.add(req);
}
List rtn = wbsendit.AddLeadToSubscriberList.addLeads(requests);

Next Steps

Below are two articles that are recommended reading and the best next steps.

FAQs

How can I delete a smart email mapping?

Working with high volumes and scheduled flows

Why are my journey email tracking statistics not being synced?

How do I troubleshoot a transactional email not being sent?

How do I apply a date format?

In this article