Visitor session - set
Table of Contents
Note:
- This task can only be executed from Zoho Sales IQ.
- Each time the zoho.salesiq.visitorsession.set integration task is executed, it triggers an API request in the back-end. This call is deducted from the external calls limit available for the service from which the task is executed, based on your pricing plan.
- Only actual executions that receive a response (whether success or failure) are counted, not the number of times the task appears in the script. For example, if zoho.salesiq.visitorsession.set integration task is placed inside a for each task that iterates five times, the number of external calls consumed will be five, even though the task appears only once in the script.
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
The KEY-VALUE response that represents the stored data.
"portal_1"
The TEXT that represents the name of the portal.
session_map
The KEY-VALUE variable that holds the data that needs to be stored.
"salesIqConnection"
The TEXT that represents the link name of the connection.
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
The KEY-VALUE Zoho Sales IQ attribute that will hold the response of the visitor.
"email"
The TEXT that represents a context_id which is a Zoho Sales IQ attribute.
visitor_email
The TEXT variable that holds the email address of the visitor.
visitorEmail
The TEXT that represents the key that can be used in zoho.salesiq.visitorsession.get task to retrieve the stored email address of the current visitor.
Response Format
Success response
The success response will be returned in the following format:
{
"url": "/api/v2/portal_1/visitorsessions",
"object": "session",
"data": {
"size": "m"
}
Failure Response
The failure response for incorrect portal name will be returned in the following format:
"error": {
"code": 1005,
"message": "Invalid portal or wrong screenname"
}
}