Using Salesforce Merge Field data within Avochato messages

Learn how to use Salesforce data in your Avochato SMS messages

There's a couple ways to achieve using Salesforce data within Avochato messages that are kicked off by a SFDC Flow.  We can either:

Option (A): Create custom fields in Avochato and sync the relevant Salesforce data to those Avochato Contact custom fields, then use those fields in a message (or send an Avochato template) to leverage those custom merge fields.

This requires the Avochato Contact data in the specific inbox that contact is receiving a message from be kept up to date with the Salesforce data before these Avochato templated messages are scheduled to be delivered. Learn more.

Option (B): Use Salesforce Flow formulas to populate the merge field data you want. Learn more.


We recommend Option B for simplicity, but both methods are valid. Read on for more information.


Option (A) requires ensuring the most up to date SFDC data has been synced to the Avochato contact, such as:

  • Using a Flow action "Avochato - Update Contact" whenever updates are made to a Contact record.
  • Manually triggering a Contact import in the Avochato web dashboard via the Integrations > Salesforce > Import Contacts button

Option (B) more or less works out of the box if your Salesforce data is the source-of-truth, and instead of using Avochato templates or $variables in your message, you'll just create these SFDC Flow text formulas to merge the data into the message before it's sent as an Avochato message.

Merge Text Examples within SFDC Flow:

Let's say this is the official message that needs to be sent to the end user (where Joe, Sept 15, and Miami are the values of dynamic merge fields):


Option (A): Using  Avochato templates and custom fields

This requires setting up corresponding Avochato custom fields for $FIRST_NAME, $APPT_DATE, and $MY_LOCATION and keeping them synced to Salesforce - learn more here.

You can send custom fields in any message, and you can use custom fields inside a template.

Assuming you have a template, you just need to insert that template’s shortcut into the message you’re sending using the $template_name syntax.

In this example, we will create a template called “Appt Reminder”

Creating a Template in Avochato under “Settings > Templates”. Templates can be used anywhere including when sending messages from Salesforce Flow Builder, Campaigns, or directly in the chat box.
Creating a Template in Avochato under “Settings > Templates”. Templates can be used anywhere including when sending messages from Salesforce Flow Builder, Campaigns, or directly in the chat box.

This creates a template with the template shortcut “$template_appt_reminder”. When you send the template shortcut as an outbound Avochato message, it transforms into the template, including all personalized fields, automatically.

Notion image

This “$template_appt_reminder” shortcut will insert the contents of the template based on was created within Avochato under the Settings > Templates and will use Avochato contact data to merge into the message, like so:

"Dear $FIRST_NAME, this is a friendly reminder that on $APPT_DATE you have a meeting at the $MY_LOCATION office."

In this example, anytime you send the text $template_appt_reminder from anywhere (the inbox, a Flow, a Campaign, etc), it will use the $FIRST_NAME and $APPT_DATE fields in Avochato.

Note: Using a template to send personalized texts is optional, but makes it easy to customize the message in one place. Any time the template gets edited, all future messages using that template will automatically send the most recent version, so you can change contents or fix typos without changing your automation. This can be handy if your template is subject to change, or you are using the same message in multiple places.

Any time you send a message from Avochato via Salesforce that includes the $custom_field syntax it will replace the fields, so you can just type out the entire message if you’d like.

Option (B): Using a SFDC Flow text formula

Using a SFDC Flow text formula, you can prepare a message that can include all the relevant fields pulled directly from the SFDC record data, and that will be merged before it's sent as a text message to the contact.

The Salesforce Flow formula looks something like this:

'Dear ' & {!Record.FirstName} & ', this is a friendly reminder that on ' & {!Record.Next_Appt_Date__c} & ' you have a meeting at the ' & {!Record.Appt_Location__c} & ' office.'

This populates all the necessary data before it's ever sent to Avochato, but will work as expected.  The downside here is that the message template is managed within the SFDC Flow automation itself, rather than living in a native Avochato template.

It's worth noting that both SFDC and Avochato fields can be used within the SFDC Flow.  For example, if first name was always more up to date within Avochato, you could modify the SFDC Flow text to read as follows, using the $FIRST_NAME merge field from the Avochato Contact data:

Did this answer your question?