Choose where you’d like to start

Visitor session - get

Note: This task can only be executed from Zoho Sales IQ.

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:

ParameterData typeDescription

<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:

  • In view of stopping new authtoken generation, a Zoho OAuth connection with appropriate scopes is mandatory in order for new integration tasks (created after the deadline specified in the post) to work as expected. Existing integration tasks will continue to work with or without the connections parameter until you manually delete the authtoken from accounts.
  • Scopes required for this task - SalesIQ.portals.ALL, SalesIQ.visitors.ALL, SalesIQ.visitors.READ, SalesIQ.visitors.UPDATE
  • Refer to this post for the list of Zoho services that support the connections page.
  • Learn more about connections

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"
     }
     }

Related Links

Get Started Now

Execute