How To: Omni-Channel Profile

Description

This how to describes the necessary steps for tracking a profile across our supported channels.

The idea:

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.

1 Getting the 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.

๐Ÿ“˜

Identification String

The identification string should be unique across channels.

2 Adding a New Contact ID

Figure 1: Merge Profile NodeFigure 1: Merge Profile Node

Figure 1: Merge Profile Node

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).

Figure 2: Storing the Unique String by Using a mergeProfile NodeFigure 2: Storing the Unique String by Using a mergeProfile Node

Figure 2: Storing the Unique String by Using a mergeProfile Node

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>'

Example

Let's assume that you have a Facebook Messenger and Slack endpoint set up.

Figure 3: EndpointsFigure 3: Endpoints

Figure 3: Endpoints

For the Facebook Messenger a typical ID looks like this:

1863277347049365

And a Slack user ID like this:

U9M9FMFKE

You can access the ID of the current channel by getting the userId property of the input object.

ci.userId

So the goal is to bundle IDs like these under the email address of our current contact.

Use Case

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).

Figure 4: Conversational Form for Getting Email AddressFigure 4: Conversational Form for Getting Email Address

Figure 4: Conversational Form for Getting Email Address

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).

Figure 5: executeForm Node for Getting the Email AddressFigure 5: executeForm Node for Getting the Email Address

Figure 5: executeForm Node for Getting the Email Address

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).

Figure 6: Merging the Received Email Address to the Current Contact ProfileFigure 6: Merging the Received Email Address to the Current Contact Profile

Figure 6: Merging the Received Email Address to the Current Contact Profile

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;

Result

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).

Figure 7: Contact ProfileFigure 7: Contact Profile

Figure 7: Contact Profile


Did this page help you?