Choose where you’d like to start

Visitor session - set

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

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:

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.

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

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

Related Links

Get Started Now

Execute