How to store interaction data inside Salesforce using Flows

Created by Seb Coulthread, Modified on Tue, 23 Apr 2024 at 10:34 PM by Seb Coulthread

How to store interaction data in Salesforce



Talkative passes information through to Salesforce via three custom Objects:

  1. Interaction
  2. Interaction Data (Data Collection Forms and Chatbot data)
  3. Agent Status

We will be focusing on Interaction Data in this tutorial as it contains the Key:Value pair, but the principle for storing data from other object works much in the same way.

For more information about each object please see the following link:

Salesforce data objects

Chose the object you want the data saved to and add in any custom fields. Data gets sent as a Key:Value pair. In our example we will populating the “Contact” object with new customer data collected from a data collection form. The forms are setup in your Talkative widget configs, under the Data Collection tab.


Key:Value pairs from Talkative Data Collection Forms




Below is an example of a data collection form with a mixture of standard (name, email, phone number) and custom (custom text field and picklist) fields.


Key:Value pairs from Dialogflow

There are two types of parameters we recommend adding to Dialogflow intents, Outcome and Journey. 


Outcome gives a status of what happened to that chat. Partially contained, the customer started a chat with the bot and then dropped off. Fully contained, the bot was able to answer all questions and chat ended. Handoff, the chat needed to be transferred to an agent.


Journey is the name of the journey they went through.


Please see below for the "parameter name" : "value" that needs to be added into Dialogflow and your Salesforce flows(Key:Value pairs), the parentheses in the below pairs should be excluded as they only reference which intents the pairs need to go into.


Outcome: PartiallyContained (in welcome intent)

Outcome: Handoff (in transfer intent)

Outcome: FullyContained (in close conversation intent) 

Journey: "journey-name" (in the start intent of each journey, only needs to be added to start of the journey, not to any of the the follow up intents)



Welcome intent, Outcome : PartiallyContained


Login Problem Journey, Journey : Login-Problem



Salesforce Object Fields

For every field that is created in the data collection form (or that is sent via chatbot), you will need to create a corresponding field in a Salesforce object.

The fields can be added to any object, but best practice is to keep customer data in the contact object.



Optional: edit the Contact page and compact layouts to include custom fields. (see below)


Create the flows

Click the gear icon in at the top right of the screen and select “Setup”.



In the “Quick Find” box on the left type “Flows” and click on Flows under Process Automation.



Click “New Flow”.



Select “Record-Triggered Flow and click “create”.



In the Configure Start window add in the following settings:


Set Entry Conditions (optional): Use this area to set rules for triggering the flow only if a certain set of conditions are met.

In our example we only want the data to be added/updated at the end of the interaction as the interaction data object is only sent a short time after the interaction object so won’t be available at the start of the interaction.

Some data is also sent during the interaction so best practice is to poll for the data at the end of the conversation, unless you have specific triggers that need to fired along the way, such as with case creation.


Summary of current flow:


Next step is to add in variables.

For every interaction record you want to save, you will need to add in a variable to the flow.

For example, we want to extract the customer email and last name from our Key:Value pairs that get passed in our interaction data record so we will create an “email” and “last name” variable.


Open the Toolbox



Click on “New Resource”


For Resource Type select “Variable”. API Name is whatever you want to call the variable in the flow, Data Type as Text(or number if you have a phone number, etc). Leave all other values as default. Click "Done" when ready.



Add an element after Start



Add in a “Get Records” element



Add the following settings and click “Done” when ready



This will get all the records from the “Interaction Data” object (see below)


The next step will be to “loop” through the interaction data object, isolate the Key:Value(data) pair and add the data to the variables we created earlier.


Add an element after the Get Records element



Add in a “Loop” element



Add in the following settings and click “Done” when ready


Add an element inside the loop 



Add in a “Decision” element



This is where we tell the loop which Key to look for in the Key:Value pair. We do this by telling it to look for: {!Loop_through_records.TalkativeEngage__Key__c} in the “Resource” block condition. The “Value” being the api name you decided to use in Talkative when designing the data collection form.

Add in the following settings and click “Done” when ready



Now that we have found the Key which equals “email”, we want to assign the data that belongs to that Key to our “flow_email” variable we created earlier.


Add an element after the “email exists” outcome



Add in an “Assignment” element



Add in a Label, API Name and Description. Select one of the Variables you created earlier in the Variable block and use the following in the Value block:


Click “Done” when ready



Keep adding in decisions for every Key:Value pair you want to extract, in our example we wanted to extract two Key:Value pairs (email and last name) so we added in two decisions.



Now that you have the Key:Value data extracted and saved as variables in the flow, it's up to you what you want to do with them.

In our example we will create a new Contact record with the data and save the records to the fields we created in the Contact object at the start of this tutorial.


Add an element after the loop



Add in a “Create Records” element


Add in the Label, API Name and Description. The object we want to create a record on is the "Contact" object. Map the field values for the Contact to the corresponding variables in the flow and click “Done” when ready


Our final example flow looks like the following:


All that is left to do is "Save" and don't forget to "Activate" the flow when you are ready to have it go live.


Please note that although this flow functions it is still very basic and will need to be expanded on.

You will need to account for many different scenarios, such as:

  • Check if the record is present in the object, if not, then add it. If it is present, then ignore creating a new contact.
  • If a record exists but not all data matches, which piece of data is more up-to-date, the new data coming in or the record already in salesforce?

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article