1. Home
  2. TrueDialog Integrations
  3. Salesforce
  4. Messaging
  5. Salesforce – Sending a Mass SMS from Flow

Salesforce – Sending a Mass SMS from Flow

Salesforce Logo

Salesforce

TrueDialog Integration

System Administrator Permissions Required

The user must be able to create Flows and Classic Email Templates. Contact your system administrator for assistance if you can’t complete these instructions.

In this article, you will learn how to send a Mass SMS to your records using a flow. While there are many ways to create a flow using the TrueDialog Mass SMS From Flow, this example will show you how to send the message to a list of Contact records at a scheduled time.

The two essential components for the Mass SMS From Flow action are idsList and templateName. The idsList is a multi-item text variable created in the flow, and the templateName is an SMS message template from the Classic Email Templates page. The article’s instructions provide guidance on creating a template and flow to use the TrueDialog Mass SMS From Flow action, as shown in the screenshot below.
Flow Overview

Create Template

The SMS message sent by Mass SMS From Flow action is stored in a template. Before sending a Mass SMS with your flow, you must create a template with your message. Below are simplified instructions for creating a message template. If you are unfamiliar with creating a template, see the Salesforce – Creating a Message Template article for instructions.

  1. From the New Template form.

    For instructions on finding this form, see the Salesforce – Creating a Message Template article.

  2. Select the Text template type.
  3. Click Next.
    Select Text
  4. Check Available For Use.
  5. Enter the template name in the Email Template Name textbox.

    The field for the template name must include the following three items in any order: SMS, object type (for example, Contact or Lead), and a descriptive name. Putting the descriptive name first is recommended because the SMS messaging app will cut off the end of long template names when listing all available templates. The template name used in the guide is Mass Flow SMS Contact.

  6. Click the Template Unique Name textbox to auto-populate it with the Email Template Name with spaces replaced by underscores.
  7. (Optional) Enter a description of the template in the Description textbox.
  8. Enter any text in the Subject textbox.

    The Subject field is required for the template form but is not part of the mass SMS sent by the flow.

  9. Enter your SMS message in the Email Body textbox.

    This example uses dynamic content in the message by including the contact’s first name. For instructions on adding dynamic content, see Salesforce – Creating a Message Template article.

  10. Click Save.
    Fill Out Template
  11. Copy the Email Template Name; this name specifies which template to use in the Mass SMS From Flow action.
    Copy Email Template Name

Create Flow

While there are many ways to create a flow using the TrueDialog Mass SMS From Flow action, this example will show you how to send the message to a list of records at a scheduled time.

New Flow

  1. Click the Settings Gear icon to open the settings menu.
  2. Click Setup.
    Click Setup
  3. Enter flows in the search box.
  4. Click Flows under the Process Automation section.
    Click Flows
  5. Click New Flow.
    Click New Flow
  6. Select Start From Scratch.
  7. Click Next.
    Select Start From Scratch
  8. Select Schedule-Triggered Flow.
  9. Click Create.
    Select Schedule-Triggered Flow
  10. Configure your schedule.
    Enter Flow Schedule

Build Contact List

To use the Mass SMS From Flow Apex action, you must create a list of records to send the message. This list must be created using logic in your flow. The instructions below will help you create a basic record list that includes all Contact records not set to SMS Opt Out. You can customize the list further by adding other filters and logic, but that’s beyond the scope of this article. The following screenshot shows the completed logic you will create.

Build List Loop

Get Records Element

You will use the Get Records element to get a list of all Contact records and filter it to include only records with the SMS Opt Out field set to false.

  1. Click the circle of the connector between the Start and End elements to add a new Element.
    Click Add Element
  2. Click the Get Records element in the Data section of the Add Element menu.
    Click Get Records
  3. Enter a name for the element in the Label textbox.
  4. Click the API Name textbox to auto-populate it with the Label with spaces replaced by underscores.
    Enter Label and API Name
  5. Enter Contact in the Object textbox.
  6. Click Contact from the dropdown list.
    Click Contact
  7. Create a filter to only include contacts NOT Opted Out of receiving SMS messages.
    1. Enter SMS Opt Out in the Field textbox of the Filter Contact Records section.
    2. Click the SMS Opt Out field from the list.
      Click SMS Opt Out
    3. Enter false in the Value textbox.
    4. Click $GlobalContstant.False from the dropdown list.
      Click False
  8. Select All records for the How Many Records to Store question.
    Select All records

Loop Element

You will use the Loop element to access each record of the list created by the Get Records element above.

  1. Click the circle of the connector between the Get Records and End elements to add a new Element.
    Click Add Element
  2. Click the Loop element in the Logic section of the Add Element menu.
    Click Look
  3. Enter a name for the element in the Label textbox.
  4. Click the API Name textbox to auto-populate it with the Label with spaces replaced by underscores.
    Enter Label and API Name
  5. Click the Collection Variable textbox.
  6. Select the record variable under the Get Records section. In this example, the variable is named Contacts from Active Contacts because the Get Records element gets Contact records and is named Active Contacts.
    Click Contacts from Active Contacts

Assignment Element

You will use the Assignment element to save the Contact ID of the currently selected record of the Loop. Each Contact ID will be saved as a text value to a list to be used in the Mass SMS From Flow action.

  1. Click the circle of the connector for the For Each section of the Loop to add a new Element.
    Click Add Element
  2. Click the Assignment element in the Logic section of the Add Element menu.
    Click Assignment
  3. Enter a name for the element in the Label textbox.
  4. Click the API Name textbox to auto-populate it with the Label with spaces replaced by underscores.
    Enter Label and API Name
  5. Click the Variable textbox in the Set Variable Values section.
  6. Click New Resource.
    Click New Resource
  7. Click the Resource Type dropdown.
  8. Select Variable.
    Click Variable
  9. Enter a name for the variable in the API Name. Don’t include spaces in the name.
    Enter API Name
  10. Click the Data Type dropdown.
  11. Select Text.
    Click Text
  12. Check the Allow multiple values (collection) checkbox.
  13. Click Done.
    Check Allow Multiple Values
  14. Click the Operator dropdown in the Set Variable Values section.
  15. Select Add.
    Click Add
  16. Click the Value textbox.
  17. Select Current Item from Loop under the Record (Single) Variables section.
    Click Current Item from Loop

Alternatively, you can input {!Get_Contact_Ids.Id} in the Value textbox. In this example, the Get_Contact_Ids variable refers to the name of your loop; if your loop is named differently, you must adjust the variable reference accordingly.
Enter Value

Add Mass SMS From Flow

After creating the list of Contact Ids, you can add the Mass SMS From Flow Apex action. This action will send a Mass SMS message to your list of records.

  1. Click the circle of the connector between the After Last of the Loop and the End element to add a new Element.
    Click Add Element
  2. Enter mass SMS in the search box for the Add Element menu.
  3. Click the Mass SMS From Flow Apex action.
    Click Mass SMS From Flow
  4. Enter a name for the element in the Label textbox.
  5. Click the API Name textbox to auto-populate it with the Label with spaces replaced by underscores.
    Enter Label and API Name
  6. Click the idsList textbox.
  7. In the Simple Collections section, select the variable with the list of contact Ids. This example uses the variable List_Of_Contacts created in the Assignment Element section above.
    Click List_Of_Contacts
  8. Enter the name of the template with the message you want to send. The template name is found in the Email Template Name field for the Classic Email Templates. See the end of the Create Template section above for details on finding the template name.

    The Template Unique Name is NOT the correct value to enter in the templateName textbox.Enter Name of Template

  9. The inputLink, sendAsVoice, and userId variables are all optional. For instructions on using these parameters, see the corresponding sections below.

    If no userId is set, the flow will select the User who triggered it, usually the System Admin User. As a result, the messages will be sent from this User’s TrueDialog channel. This User will also be the Owner of the SMS records. To prevent this, enter the User ID for which you want to send the Mass SMS for the userId variable.

Save and Activate

  1. Click the Save button from the button bar at the top of the page.
    Click Save
  2. Enter a name for the flow in the Flow Label textbox.
  3. Click the Flow API Name textbox to auto-populate it with the Flow Label with spaces replaced by underscores.
    Enter Label and API Name
  4. Click Save.
    Click Save
  5. Click Activate.
    Click Activate
  6. Once activated, the flow will send your message to your records at the scheduled time.
  7. (Optional) To send your message immediately, click Run.

    If active, the flow will also run at the scheduled time.

    Click Run

Options

TrueDialog provided link shortening and link tracking for SMS messages. The instructions below show you how to add a link to the Mass SMS From Flow Apex action in a Flow. The TrueDialog Portal reports the number of clicks for your shortened links. See the Accessing The Portal and Viewing Clicks Report articles for details on accessing the Portal and viewing the Click Report.

  1. Edit the Send Message Apex Action.
  2. Click the inputLink toggle.
    Toggle inputLink
  3. Enter your link to be shortened in the inputLink textbox.

    You can only add one shortened link per message.

    Enter Link
  4. The inputLink option should look like the screenshot below.

    The shortened link will be added to the end of the template message with a space between the template message and the shortened URL.

    inputLink Option
  5. The screenshot below shows how a message with a shortened link looks when received by the contact.
    Received Mass SMS

Send As Voice

TrueDialog enables sending mass messages using automated text-to-speech software to deliver your message to your contacts via a voice call. Follow the instructions below to use this feature.

  1. Edit the Send Message Apex Action.
  2. Click the sendAsVoice toggle to enable voice for this message.
    Toggle sendAsVoice
  3. Click the sendAsVoice textbox.
  4. Select True under Global Constants.
    Click True
  5. The sendAsVoice option should look like the screenshot below.
    sendAsVoice Option

User Id

The userId option enables you to select a Salesforce user from whom the mass SMS will be sent. The messages will be sent from the chosen user’s TrueDialog channel, and that user will also be designated as the Owner of the SMS records. Follow the instructions below to select a User.

The User selected must have an active and authenticated TrueDialog account, meaning they must be able to send SMS messages using the TrueDialog integration.

If no userId is set, the flow will select the User who triggered it, usually the System Admin User. As a result, the messages will be sent from this user’s TrueDialog channel. This user will also be the Owner of the SMS records. To prevent this, enter the User ID for which you want to send the Mass SMS for the userId variable.

The userId variable only supports a single User ID value because, by design, a Mass SMS message is sent from a single channel. You can create logic in your flow to dynamically select a single user to send the Mass SMS message, but you can not select a list of users to send specific messages.

Find User ID
  1. Click the Settings Gear icon to open the settings menu.
  2. Click Setup.
    Click Setup
  3. Enter users in the search box.
  4. Click Users under the Users section.
    Click Users
  5. Click the Name of the user to get the ID.
    Click User
  6. Click View Summary.
    Click View Summary
  7. Copy the User ID value to enter in the userId of the Mass SMS From Flow Apex Action.
    Copy User ID
Enter userId
  1. Edit the Send Message Apex Action.
  2. Click the userId toggle.
    Toggle userId
  3. Enter in the userId textbox the User ID the Mass SMS will be sent from. See the Find User ID section above to find the User ID value.
    Enter User ID

Updated on January 18, 2025
Was this article helpful?
Need Support?
Can’t find the answer you’re looking for? Don’t worry we’re here to help!
CONTACT SUPPORT

Leave a Comment