This how to describes the necessary steps for tracking a profile across our supported channels.
Bundling all the user IDs from the different channels under one unique ID
The Process is divided into two steps:
1. Getting a unique identification string from the contact (e.g. his email address)
2. Store the retrieved identification string as a contact ID by using a mergeProfile node
After merging the identification string to the list of contact IDs you should be able to retrieve all the contact profile informations by using this unique identification string.
At some point in your flow you have to get a unique string that identifies the current contact to our COGNIGY.AI platform. For retrieving this identification string you can use different approaches like a conversational form or a custom approach with say nodes and nodes that store the data in the context.
The identification string should be unique across channels.
After receiving and validating the identification string from the contact you can add the current user ID to the contact's list of contact IDs. Add a mergeProfile node (see FIgure 2) to your flow on the position where you have access to the identification string and want to merge the current user ID to the contact profile. Enter into the ContactId field of the mergeProfile node the identification string you've just gathered from the current contact (e.g. his email address).
Now whenever the mergeProfile node gets executed it will add the identification string to the contact's list of contact IDs.
With the newly added contact ID you're also able to use our API to update the contact profile by using the identification string. For our demo environment you could do the following API call to get the contact profile data of the current contact:
curl -XGET -H 'X-API-Key: <YOUR_API_KEY>' 'https://api-demo.cognigy.ai/contact/<UNIQUE_STRING>'
Let's assume that you have a Facebook Messenger and Slack endpoint set up.
For the Facebook Messenger a typical ID looks like this:
And a Slack user ID like this:
You can access the ID of the current channel by getting the userId property of the input object.
So the goal is to bundle IDs like these under the email address of our current contact.
Now let's assume that we have a simple bot that first asks the user to enter his email address and, after validating and storing the email address, it uses the address to fetch the contact profile data. With the contact profile data it will perform further actions, like HTTP requests or database queries.
So first we have to get the email address of the contact. We'll request it by using a conversational form (see Figure 4).
Then we place this conversational form at the beginning of the flow. So now, whenever a contact starts a conversation with the flow, he'll be prompted to enter his email address.
We'll store the address in the context under the address key (see Figure 5).
After entering his email address the contact will hit the On Finish branch of our executeForm node. There we'll add the mergeProfile node. In the node's settings we can paste the received email address in the contactId field (see Figure 6).
Now, in case the contact profile has already an entry for this email address in it's contact IDs list we should be able to retrieve the corresponding contact profile information by accessing the contact profile in a code node:
const contactProfile = cp;
After adding the Facebook Messenger and Slack user IDs to the contact profile the contact profile should contain the channel IDs and the email address (see Figure 7).
Updated almost 3 years ago