Skip to main content
All CollectionsIntegrationsSalesforce
Add automated text messages to your Salesforce flows
Add automated text messages to your Salesforce flows
Updated over 8 months ago

The TextUs integration for Salesforce allows you to build a custom record-triggered flow that automatically sends SMS text messages when a record in your Salesforce account is created, updated, or deleted using specific criteria.

Note: Before you can build a record-triggered flow, you need to complete your TextUs App integration in Salesforce and set up your API key. For more information, see How to Set Up Your Salesforce Integration.

What’s a record-triggered flow?

Record-triggered flows are used to automatically perform actions in Salesforce behind the scenes when a record is changed in a specific way. Record-triggered flows consist of a trigger, at least one criterion, and at least one action. Simply put, the job of a record-triggered flow is, “If something happens, then do something else.” For more information on record-triggered flows, see the Salesforce knowledge base.

While there are a wide range of possible use cases for record-triggered flows, the steps in this guide focus on the following example use case:

  • As a Salesforce user, I want my TextUs integration to automatically send my contact information to a business lead when their Salesforce record is created or updated with a HOT rating.

Using our example use case, the outline for building a record-triggered flow looks like the following:

Component

Description

Example

Trigger

Identifies what launches the flow, such as a set schedule or when a specific type of record change occurs.

A business lead is created or updated.

Criteria

Defines the specifics of the trigger, such as the specific time or the specific changes made to a record.

The business lead’s rating equals HOT.

Action

Determines what action is performed when the trigger and criteria are met.

Notify a record in Salesforce by sending a text message to a business lead with your organization’s contact info (such as name, email, or phone number).

Build your record-triggered flow

Note: Due to the wide range of possible use cases for triggering automated messages, the steps in the sections below follow an example use case that builds a record-triggered flow that is triggered with an Apex action.

Enter your TextUs API token

Before you begin building your record-triggered flow, you'll need to enter your TextUs API token in Salesforce:

  1. Log in to the TextUs web app.

  2. Click on your user icon on the top right of the screen, then click Profile > API Tokens and copy your API token.

  3. In Salesforce, click the App Launcher and search for TextUs.

  4. On the top navigation bar, click TextUs Admin Settings.

  5. In the TextUs API Key section, click Edit.

  6. Paste your TextUs API token in the Enter TextUs API Key field, then click Save Key.

Create a new flow

To create your new flow, complete the following steps:

  1. On the Setup page, enter Flows in the Quick Find search box, then select Flows.

  2. Click New Flow.

  3. Select Record-Triggered Flow, then click Create.

Configure the start trigger

Next, configure the trigger and set entry conditions on the Configure Start menu.

Note: You can configure a trigger for both Leads and Contacts by cloning the flow and making adjustments for the object's condition requirements.

  1. In the Label field, enter either Lead or Contact.

  2. Under Configure Trigger, select A record is created or updated.

  3. Under Condition Requirements, select All Conditions Are Met (AND).

  4. Define the first condition. Below are the example values for our use case:

    • Field: Enter Rating.

    • Operator: Select Equals.

    • Value: Enter Hot.

  5. Under When to Run the Flow for Updated Records, select Only when a record is updated to meet the condition requirement.

  6. Under Optimize the Flow for, select Actions and Related Records. Note this option is required to perform Apex actions.

  7. Click Done, then click Save.

  8. On the Save the flow menu, enter the following information:

    • Flow Label: Enter Automated Message Send.

    • Flow API Name: This field auto-populates with the API name.

    • Description: Enter an optional description for the flow.

  9. Click Save.

The resulting flow for our example use case looks like the following:

  • Start

  • Record-Triggered Flow

  • Object: Lead

  • Trigger: A record is updated

  • Conditions: 1

  • Optimize for: Actions and Related Records

Create a new Apex action for your flow

Now that you have created your flow, use the steps below to create an Apex action that will send the contact or lead an SMS text message when the flow is triggered.

Note: The steps in this section use the Free-Form view on the Flow Builder page. You can switch between the Free-Form and Auto-Layout views by using the dropdown menu at the top of the Flow Builder page.

  1. On the Toolbox left sidebar, click the Elements menu, then drag and drop the Action icon to your Flow Builder.

  2. On the New Action menu, enter Next Send Texts to Mapped Records in the search box, then select the action from the search results.

  3. On the New Action menu, enter the following information:

    • Label: The label name. For example, “Send Text”.

    • API Name: This field auto-populates with the API name.

    • Description: An optional description.

  4. Under Set Input Values for the Selected Action, enter the following information:

    • Message Text: The message body that you want to send to the contact or lead. This field can contain text characters or you can create a new resource to store the message as a template.

    • Phone Number: The phone number of the contact or lead receiving the message. We recommend using a TextUs Phone field variable in this field to keep the action dynamic when leads or contacts have multiple phone numbers.

    • User Email: The email address of the user in your organization who is sending the text message. This field can contain an email address or a variable, but the value must match a valid messaging account email for a user in your TextUs org account.

    • User Phone: The phone number of the user who is sending the message. This field can contain a phone number or a variable, but the value must match a valid messaging account number in your TextUs org account.

  5. Click Done to update your settings.

Connect your Apex action to your flow

On the Flow Builder page, click the circle at the bottom of the Record-Triggered Flow icon and drag the gray line to connect it to the Apex Action icon. When you are finished, click the Save button to update your flow.

After you finish creating your record-triggered flow, it’s best practice to debug the flow immediately by clicking the Debug button at the top of the Flow Build page. Testing your flow before activating it lets you try different scenarios without impacting your data.

When you are ready to make your record-triggered flow live, click the Activate button.

Did this answer your question?