Secure Chat Conversation Context
Overview
This article details how to set a secure conversation context on a Quiq Web Chat conversation, without having your secure back end environment initialize the conversation (for that process see Secure Web Chat).
The approach in this article is useful if your scenario involves wanting to set a secure context on a conversation, but not actually start the conversation until the user sends the first message.
Storing a Secure Context
The first step is to store a secure context from your secure back end environment by making a call to Quiq’s stored-context API (oftentimes this is done after the user has authenticated themselves with your system).
Here's an example secure context payload for setting a custom field:
{
"context": {
"integrations": [
],
"fieldUpdates": [
{
"field": "schema.conversation.customer.custom.accountNumber",
"value": "12345678"
}
]
}
}
This API will take a payload where you can specify either an integration reference (if you want to set the context to an object you have created with your CRM) and/or a series of conversation or contact custom field values (perhaps containing a user id or email address) that you would like to set on the conversation once it starts.
When you call this API, you will receive a response that contains a signed GUID. You will need to pass this GUID up to your client layer so that it can be used in the next step.
Passing the Secure Context Id into the Chat SDK
Once you have a signed GUID from the stored-context API handy at your client layer, you can use it to set the context on a conversation that hasn’t actually begun.
To do so, use Quiq’s setChatContext operation on our Web Chat SDK and set the storedContextId field to the signed GUID you received in the last section.
chat.on('statusChanged', async (event) => {
if (event.data.status === 'initialized') {
chat.setChatContext({'storedContextId': 'MTMyNDViMmMtZWNjZS00YzAwLTllYTUtNDc5YTcyZWMwZjMz'}, true);
}
});
Then, when the user sends in their first message, the conversation will be started and any integration references or custom field values you specified will be applied to it and be visible to the agent working the conversation in Quiq.
Limitations
The signed GUID you received after calling the stored-context API will expire after 1 hour by default, so if the end user waits longer than that to start the conversation, the context will no longer be set. If this time frame is problematic, please reach out to Quiq Support to discuss the possibilities around extending this timeout.
Other Platforms
If you are using ABC and Google Business Messages as handoff platforms for mobile chat users, the process above will also work without any additional changes.
If you are wanting to use manually generated links on your site to invoke ABC, Google Business Messages, or Facebook Messenger without using Quiq’s Web Chat, you can also set a secure conversation context. Please reach out to Quiq Support for assistance if you prefer to go this route.
Updated 8 months ago