Visitor session - get
Table of Contents
Note:
- This task can only be executed from Zoho Sales IQ.
- Each time the zoho.salesiq.visitorsession.get 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.get 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.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
The KEY-VALUE response that represents the stored data.
"portal_1"
The TEXT that represents the name of the portal.
"name"
The TEXT that represents the key whose data needs to be fetched.
"salesIqConnection"
The TEXT that represents the link name of the connection.
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
The KEY-VALUE variable that holds the email address of the current visitor captured using zoho.salesiq.visitorsession.set task.
visitor_name
The KEY-VALUE variable that holds the name of the current visitor captured using zoho.salesiq.visitorsession.set task.
Response Format
Success Response
The success response will be returned in the following format:
{
"object": "session",
"url": "/api/v2/portal_1/visitorsessions",
"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"
}
}