Salesforce to Avochato Contact Sync using Flow builder
Use Salesforce Flow automation to update Avochato contacts based on Salesforce data
Avochato for Salesforce offers a robust data sync from Avochato to Salesforce, including contact data and any messaging or call activities.
But sometimes there are critical data points being updated on your Salesforce system that you would like to update within the Avochato contact:
- In one use case, you may want to update the Avochato Contact’s Owner to mirror the Salesforce’s Contact/Lead’s owner when it was just changed in Salesforce.
- Another use case would be to associate a specific Salesforce record with an Avochato Contact via the phone number, when you have multiple potential matches from Salesforce, but want to prescriptively associate the main Salesforce record with that Avochato Contact’s phone.
Below is a step by step guide to creating a Flow in Salesforce to leverage the “Avochato - Update Contact” action to update the Avochato’s Contact and Conversation owner based on a change to the Salesforce record’s owner.
1. Confirm API Credentials are Active
In order to use any of the Avochato API actions within Flow builder (or List View Broadcasting or Apex Code), you need to have sent the Avochato API credentials to Salesforce, and confirm they’re saved properly in Salesforce. See this article on how to save, enable, and confirm your Avochato API credentials within Salesforce.
2. Create a Flow
We’ll show an example of manually assigning a Salesforce Contact’s Id and SObjectType (as well as Owner) to an Avochato Contact, using the phone number as the identifier to match the records.
Sample Use Case
Let’s describe the use case:
“Oh the Joy” is a tech company that sells an app geared towards elementary students to learn math and science in a fun, interactive way. They often sell different products within the app to multiple children within the same family, and hence, the same phone number can be associated with multiple people within the same family (since they’re signed up under their parent’s mobile phone number).
Oh the Joy uses Avochato for Salesforce to communicate with parents, and they want to assign the parent’s Salesforce Contact Id and Type to the Avochato Contact, so that messaging activity syncs to the parent’s Salesforce Contact record, rather than the Avochato contact accidentally assigning itself to one of the children’s Salesforce records.
Oh the Joy usually uses the Phone
field on Contacts to populate a phone number. They will fill in the MobilePhone
field when it’s the official Salesforce record that they want to associate with the Avochato Contact that matches the same phone number.
Let’s use a Salesforce Record-Triggered Flow to listen for any changes to Contact.MobilePhone
and use the Avochato action to update the Avochato Contact’s Salesforce ID and Type.
Contact Record-Triggered flow, step by step
- Go to Salesforce’s Setup → Flows.
- Click the “New Flow” button in the upper right corner to create a new Flow.
- Create a Contact Record-Triggered Flow
- For Select Object, type in and choose “Contact”, and select the “A record is updated” radio button option for when to trigger the Flow.
- For Entry conditions, set the Condition Requirements to “All Conditions Are Met (AND)”, and set
- The field to
MobilePhone
, operator “Is Changed” and Value to “$GlobalConstant.True” - The next field to
MobilePhone
, operator “Is Null”, and Value toFalse
, so that we ensure there’s indeed a phone number value within theMobilePhone
- “When to Run the Flow for Updated Records” will automatically be set to “Every time”, and we want to Optimize the Flow for “Actions and Related Records”
- Make sure to mark the checkbox to Include a Run Asynchronously path, as the Avochato action is a callout to an external system
- Now you will see an empty Flow, with paths to Run Immediately and Run Asynchronously. Click on the “Plus” button icon within the Run Asynchronously path
- Within Add Element, start typing in “Avochato” into the search bar, and select the “Avocahto - Update Contact” action
- For this New Action, start filling in the Label and Description, like:
- Label: “Update Avochato Contact”
- API Name: “Update_Avochato_Contact”
- Description: Update the Avochato Contact's Salesforce Record ID and Type, as well as the Owner
- Within the Input Values section, start filling in the following attributes:
- phone:
{!$Record.MobilePhone}
- This phone attribute is the main field to populate, which will be used a the unique identifier to match the Avochato Contact.
- salesforce_object_id:
{!$
Record.Id
}
- salesforce_object_type:
Contact
- These two fields will ensure the Avochato Contact is linked to this triggering Salesforce Contact Record, and any activity and data changes will sync properly to this Salesforce record
- (Optional) tags:
<some useful tag>
- Setting a tag (or tags that are comma separated) is a great way to set Avochato Tags on the Avochato Contact, so that you can see when a particular Avochato Contact was updated by Salesforce flow automation
- A sample value here could be
flow-sfdc-id-updated
- (Optional) subdomain:
<your Avochato Inbox of choice>
- If you have multiple Avochato Inboxes / Accounts, type in the subdomain of the inbox where the Avochato Contact lives. For example, you may have an inbox
ohthejoy
andohthejoy_support
as a separate dedicated Avochato line for support inquires. Populate this subdomain if you want to specifically update an Avochato Contact within that specific Inbox
If you have multiple inboxes, the Avochato user whom you generated the Avochato API credentials for that synced to Salesforce, must be an active Avochato user in each inbox in order for the API callouts to work. If that Avochato User is only part of the ohthejoy
inbox, then trying to update an Avochato Contact within the ohthejoy_support
inbox will fail
- Click Done to save the Avochato action
- Click “Save” in the upper right corner of the page, and give the Flow some useful Label and Description:
- Flow Label:
Contact API Actions Automation
- Flow API Name:
Contact_API_Actions_Automation
- Description:
When MobilePhone is updated, update the matching Avochato Contact's Salesforce record ID and type
- Click “Save”, then click on “Activate” to enable the automation
- Done!
3. Test and confirm
- Go into the existing Salesforce Contact record of choice, and update the Mobile Phone number (if it already exists, just delete it, save the record, re-edit and put the same phone number back in).
- Save the new updated Mobile Phone.
- Within Avochato, search for the Avochato Contact/conversation by that same phone number.
- When you click into the Avochato Contact/conversation, you’ll see the Avochato Tag was added from Flow builder, which confirms that Salesforce successfully updated the Avochato Contact information