Visitor session - set
Table of Contents
Overview
The zoho.salesiq.visitorsession.set task temporarily stores values during a chat conversation with your website visitors. This is used when your Sales IQ Zobot needs to remember dynamic pieces of information until the end of a session (chat conversation).
Syntax
<response> = zoho.salesiq.visitorsession.set(<portal_name>, <session_data>, <connection>);
where:
Parameter | Data type | Description |
<response> | KEY-VALUE | The response returned by Zoho Sales IQ that represents the stored data. |
<portal_name> | TEXT | Name of your Zoho Sales IQ portal. |
<session_data> | KEY-VALUE | The values that need to be remembered throughout the current session. The keys of this parameter can be used in zoho.salesiq.visitorsession.get task to retrieve its corresponding value. |
<connection> | TEXT | The link name of the connection. Note:
|
Example 1: Store a static value
The following example stores the value - M against the key - size throughout a session.
session_map = Map(); session_map.put("size","M"); response = zoho.salesiq.visitorsession.set("portal_1", session_map, "salesIqConnection");
where:
response
"portal_1"
session_map
"salesIqConnection"
Example 2: Store a dynamic value
The following example gets an email address from the visitor and stores it as a value to the key - visitorEmail throughout a session.
// Get name from the visitor's response visitor_email = answers.get("email").get("text"); // Create a map to hold the data that needs to be stored session_map = Map(); session_map.put("visitorEmail",visitor_email); response = zoho.salesiq.visitorsession.set("portal_1", session_map, "salesIqConnection");
where:
answers
"email"
visitor_email
visitorEmail
Response Format
Success responseThe success response will be returned in the following format:
{
"url": "/api/v2/portal_1/visitorsessions",
"object": "session",
"data": {
"size": "m"
}
The failure response for incorrect portal name will be returned in the following format:
"error": {
"code": 1005,
"message": "Invalid portal or wrong screenname"
}
}