Visitor session - get
Table of Contents
Overview
The zoho.salesiq.visitorsession.get task fetches the value temporarily stored by the zoho.salesiq.visitorsession.set task. This is used when your Sales IQ Zobot needs to use dynamic pieces of information until the end of a session (chat conversation).
Syntax
<response> = zoho.salesiq.visitorsession.get(<portal_name>, <key>, <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. |
<key> | TEXT | The name of the key used in zoho.salesiq.visitorsession.set task to store the value that needs to be fetched. |
<connection> | TEXT | The link name of the connection. Note:
|
Example 1: Fetch a session value
The following example fetches the value stored against the key - name.
response = zoho.salesiq.visitorsession.get("portal_1", "name", "salesIqConnection");
where:
response
"portal_1"
"name"
"salesIqConnection"
Example 2: Send email to the fetched email address
The following example sends an email to the address of the visitor stored against the key - email.
// Fetch name and email address of the visitor visitor_email = zoho.salesiq.visitorsession.get("portal_1", "email", "salesIqConnection").get("data").get("email"); vistor_name = zoho.salesiq.visitorsession.get("portal_1", "name", "salesIqConnection").get("data").get("name"); // Send email using send mail task sendmail [ from: zoho.adminuserid to: visitor_email subject: "Help resources" message: "Hello, " + visitor_name + ". Please find the help resources in the attachments.<br>Thank you,<br>Shawn" attachments: file: help_resource ];
where:
visitor_email
visitor_name
Response Format
Success ResponseThe success response will be returned in the following format:
{
"object": "session",
"url": "/api/v2/portal_1/visitorsessions",
"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"
}
}