This delegate method allows you to handle custom triggers. The handleTrigger method provides the name of the custom trigger along with an instance of the SIQVisitor class, which contains information relating to the user.


name: Name of the trigger configured in the Invoke Client API trigger rule.
visitorInformation: An instance of the SIQVisitor class which holds visitor information.

The SIQVisitor class has the following properties:

nameName of the user
emailEmail ID of the user
phoneThe contact number of the user
osThe operating system in use
ipThe IP address of the user
countryCodeCountry code of the user
regionRegion of the user[APAC/CANADA/EMEA/NA/SA]
stateState of the user
cityCity of the user
numberOfChatsNumber of previously closed chats
nubmerOfVisitsNumber of visits by the user
noOfDaysVisitedNumber of days the user has used the app
totalTimeSpentTotal app usage time
firstVisitTimeTime at which the user first used the app
lastVisitTimeTime at which the user last used the app


To use the handleTrigger delegate method, you need to set up the Invoke JS API.

Invoke JS APIs are used to implement custom trigger actions. Set a custom trigger action by navigating to Settings > Automation > Intelligent Triggers, and select the "Invoke JS API" option from the dropdown, as shown below.

Use the same trigger name given in the Invoke JS API as your .handleTrigger() API's name to implement your app's custom action. Once the Invoke JS API trigger is activated, the custom action defined inside the .handleTrigger() API will start to execute.

Here, we have defined a custom trigger named "Engage" that triggers visitors who have visited more than ten times but haven't initiated any chat. So if a visitor satisfies these criteria, then the trigger will be activated. In this case, the visitor will see a discount banner.

Initial Setup

Copiedlet myEventHandler = MyEventHandler()
ZohoSalesIQ.delegate = myEventHandler


Copiedclass MyEventHandler: ZohoSalesIQDelegate{

	func handleTrigger(name: String, visitorInformation: SIQVisitor) {
	    if name == "Engage"{
	 	    // your code goes here
	    }else if name == "Show Discount Banner"{
		    // your code goes here