With the help of Events on Smart Plugs, it is now possible to provide agents with pre-filled responses to user queries. Custom actions can be triggered using the events so that agents can interact faster with end-user with one click.


Some example use cases : 

  • Construct a deep link specific to the user to take her to a specific screen in your app. 
  • Look up user information, say last 5 transactions,  in your backend and populate an auto response for the user. 


Currently, the following are supported using events. 

  • Auto-populate a message to a user for the Agent to send.
  • Add a private message for the agent. 
  • Receive message when the agents resolve a conversation.



Sending a Text Message:


You can send a message by publishing a send_msg or send_private_msg event. The event needs message properties as a JSON to be provided, defined as follows 


Property Description
message Message content to be sent to the user
deeplink.url If you want to send a deeplink or a URL link. ( Required for deeplink ) 
deeplink.label Label for the button that will shown to the user for deeplink.  ( Required for deeplink ) 
picUrl Url for a picture message. 



Examples : 


Sending a message 

window.hotline.events.publish('send_msg', { message: 'This is a test reply' });

 

Sending a private message  

window.hotline.events.publish('send_private_msg', { message: 'This is a test reply' });

 

Sending a picture message with deeplink   

window.hotline.events.publish('send_msg', { 
	message: "This is Sparta ", 
	picUrl: "https://firstyearlmd.files.wordpress.com/2013/02/this-is-sparta.jpg", 
	deeplink: { 
		url: 'https://google.co.in', 
		label: 'Google'
	}
}); 

 

Note : Picture will be uploaded to Hotline and sent to the user. 


Conversation resolution


You can subscribe to a conversation resolved event to do some automated actions. For example , you can send the conversation to your CRM or update your system when the agent resolves the conversation. 


Subscription is done as follows. 

 

 

window.hotline.events.subscribe('resolved_message', function(){
	console.log("agent resolved the conversation"); 
        // Do your magic.
 });