Automated Text Messages
  • 17 Apr 2023
  • 4 Minutes to read
  • Contributors
  • Dark

Automated Text Messages

  • Dark

Article summary

Trigger a Text Message Flow

You can trigger a text message to a recipient associated with any Mogli-configured object.

When certain criteria are met, let’s trigger a text message sent to a Contact.

Note: For use cases requiring the creation of multiple SMS messages per event, we recommend scheduling a consultation with one of our Solutions Engineers.

  1. From Setup, search and select Flows. Click New.
  2. Choose any flow type and enter flow conditions as you see fit.
  3. In the Elements panel, drag a Create Records element onto the canvas. Label it, and then create ‘One’ record using ‘Separate resources and literal values’:

4. Choose SMS as your object. (Object name: Mogli_SMS__SMS__c)

Populate the Field Values as follows and click Save:

      • Direction = Outgoing
      • Status = Queued (this tells Mogli to send the message right away)
      • Gateway = A Gateway ID, variable, or the related record’s Default Gateway.
      • Message = A text string, a text formula variable, or the Text field from an SMS Template (populate using a Get Element). If your SMS Template includes merge fields, they must be found directly on the object related to your SMS record. If not, use a formula instead.
      • Phone Number = the Mogli Number of your recipient.
      • Contact (or another Mogli-configured object) = the record ID of your recipient.

5. In the upper right corner, click Save and Activate.

Note: It’s highly recommended that a good description is entered for yourself and your colleagues.

6. Create a test Contact or other pertinent record (if you haven’t already), and be sure that your Mogli Number is correctly populated (+12223334444). Click Edit, set the appropriate criteria on your record, and Save. Check to see if you’ve received the text message.

Automated SMS Best Practices

When creating an SMS record within an automated process, there are important considerations, such as how quickly you’d like the message to be sent and which fields will be required.


The Direction for automated messages will always be Outgoing.


    • Queued: The Status should be set to “Queued” if you’d like the message to be sent as soon as possible. However, if you’re sending a large number of messages (100 or more) at once, we recommend scheduling them to utilize our batch processing.
    • Scheduled:When scheduling a message in the future, populate the following fields:
        • Is Batch Transaction = TRUE (checked)
        • Scheduled Delivery = The Date/Time you want the message sent. The minimum value is +5 minutes from now [ NOW() +( 5/1440) ]. Due to Salesforce processing limitations, messages may not be received at the exact minute they’re scheduled for delivery. Also, consider the time the automation will take to successfully create and update the SMS records. If you are generating at least 100 records at one time and would like them sent right away, set this value to at least 10 minutes from NOW().
        • Batch Group ID = Set this field to a unique value each time the automation runs, but keep the value the same for each record created by the automation. For example, you can set this value to the date/time that the automation runs or something similar: “Auto-Remind-01-01-2022-1200-PM-MST”. Many individual API calls can cause processing errors and/or duplicate messages. Setting a Batch Group ID ensures the messages are part of a single batch and are sent using as few API calls as possible (~100 records each). Sample auto-generated Batch Group ID: b5841a0d-18fd-4d08-70a1-c254c331d68f.

Contact, Lead, Opportunity, and Other

As objects are configured for Mogli SMS, a lookup field is added to each SMS record. This enables the SMS record to be related to multiple objects and allows fields on the related object to be used as Merge Fields. Populate at least one related object lookup field when creating an SMS record.


Type in the message to send, or use a Get Records element in Flow to find a specific SMS Template record. Use the SMS Template’s Text field to populate your message. This would automatically trigger a related Form Template.

When using merge fields within your message, the field must be found directly on the Mogli-Configured object. This means that the object the field exists on must be related directly to the SMS record created via a lookup field.

See our Merge Fields guide for more information. Review the helpful Admin Tip in the Merge Fields For Additional Objects section.


      • Mogli can configure standard and custom objects such as Cases, Applications, and Appointments so that the information within them can be used in an SMS message.
        Example: “Hi {{firstname}}, your appointment is coming up on {{appointment_date__c}} at {{appointment_time__c}}. See you soon!”
      • Alternatively, create a formula field or use a workflow rule or flow to populate information directly onto the contact record related to the SMS.
      • Customize the message within the automation if data cannot be merged into the message via a formula field or related record. Example: “Hi ” & {!$Record.Name} & “, how are you?”

Phone Number

The Phone Number field must use the following API format: “+12223334444”. This field is most often populated using the Mogli Number field from the Mogli-configured object related to the new SMS record.

“+1” represents the Country Code and can consist of more than one digit. See Conversation Prep for more details about Mogli Number formatting.


If this field is kept blank, the global Default Gateway will be used. This value is defined in the MogliSMS Lightning App, on the Application Settings > Default record.

Reference the Default Gateway field on the related object to use the most common outbound phone number used to contact the individual. This value is typically set by the record owner. If there is no value in the Default Gateway field, the message will be sent from the global Default Gateway as specified in Application Settings.

You may also populate this field by using a Get Records element in flow to capture the ID of a specific Gateway record.

Was this article helpful?