Customer metadata
Assuming you have created a conversation channel in Admin > channels > Chat
and you have the html/javascript code that is generated, we can add custom attributes to that code.
Let's say for example we would like to send a customer id
and a department name
to a studio flow, we can look for the function setContext
and modify it as follows.
function setContext() {
webchat.setContextParam(
{
customer_id: "abc123-abc123-abc123",
department_name:'Customer Care'
});
}
Go to the Studio Flow you would like to capture the above variables, select the Initial Step
component and on the Incoming message arguments
create two new properties
- argument name :
customer_id
| map to flow variable : create a variable - argument name :
department_name
| map to flow variable : create a variable
Now you have the two variables in your context and you can use them accordingly.