Context handler does not work on iPhone app. Crashes!
I've used the sample code from your help pages regarding the context handler and it consistently crashed the app.
It consistently crashes upon the second context input
code sample on the Context Handler page causes the iPhone app to crash.
I'm using iOS 11.2
When I iterate through the Room Service context it crashes after I choose "House Keeping" or "Maintenance"
https://www.zoho.com/cliq/help/platform/bot-contexthandler.html
==
Sample Message Handler Code
response = Map();
if(message.containsIgnoreCase("ROOM SERVICE"))
{
context = '{"id":"Room Service","timeout":"300","params":[{"name":"room service","question":"Great! Here is a list of options for you to choose from.","suggestions": {"list":[{"text":"House Keeping"},{"text":"Maintenance"}]}},{"name":"time","question":"Okay cool. When can I send them over?","suggestions":{"list":[{"text":"Now"},{"text":"In half hour"}]}}]}'.toMap();
response.put("context",context);
}
else if(message.containsIgnoreCase("WIFI"))
{
context = '{"id": "Wifi", "timeout":"300","params":[{"name":"Wi-fi","question":"Confirm if you are in Room 307!", "suggestions":{"list":[{"text":"Yes"},{"text":"No"}]}}]}'.toMap();
response.put("context",context);
}
else if(message.containsIgnoreCase("CAB"))
{
context = '{"id": "Cab","timeout":"300","params":[{"name":"Cab","question": "When can I book the cab for you?","suggestions":{"list":[{"text":"Now"},{ "text": "After 1 hour"}]}}]}'.toMap();
response.put("context",context);
}
else
{
response = '{"text": "Hi! I am Lyte, the Room Service Bot. Heres what I can help you with! :happy!:", "suggestions":{"list":[{"text":"Room Service"},{"text":"Wifi"},{"text":"Cab"}]}}'.toMap();
}
return response;
Sample Context Handler Code
response = Map();
id = context.get("id");
params = context.get("params");
if(id.matches("Room Service"))
{
confirm = "Please check our other options then!";
if(params.get("confirmation").containsIgnoreCase("YES"))
{
// make api calls for the room service options
confirm = "Great! I've arranged for the " + params.get("room service").get("text") + "to be there " + params.get("time").get("text") + ". :thumbsup:";
}
response.put("text",confirm);
}
else if(id.matches("Wifi"))
{
txt = 'Please try again or call 0000 for more information!';
if(params.get("Wi-fi").containsIgnoreCase("YES"))
{
txt = 'Here is your wifi ID and password. \n ID - Room_307 \n Password - Hotel123';
}
response.put("text",txt);
}
else if(id.matches("Cab"))
{
txt = 'Your cab has been booked exactly one hour from now. Please meet the driver at the hotel lobby.';
if(params.get("Cab").containsIgnoreCase("NOW"))
{
txt = 'You Cab has been booked. Please meet the driver at the hotel lobby. :thumbsup:';
}
response.put("text",txt);
}
else
{
response.put("text","Context: " + context);
}
return response;
Access your files securely from anywhere
Zoho Developer Community
Deliver unforgettable customer experiences
Deliver unforgettable customer experiences
New to Zoho Marketing Plus?
Everything you need to run your marketing
New to Zoho Marketing Plus?
Everything you need to run your marketing
Zoho Desk Resources
-
Desk Community Learning Series
-
-
-
-
-
-
-
-
-
Sticky Posts
Convert a message on Cliq into a task on Zoho Connect
Message actions in Cliq are a great way to transform messages in a conversation into actionable work items. In this post, we'll see how to build a custom message action that'll let you add a message as a task to board on Zoho Connect. If you haven't created
Cliq Bots - Post message to a bot using the command line!
If you had read our post on how to post a message to a channel in a simple one-line command, then this sure is a piece of cake for you guys! For those of you, who are reading this for the first time, don't worry! Just read on. This post is all about how
Cliq Bots - How to make a bot respond to your messages?
Bots are just like your buddies with whom you can interact. They carry out your tasks, keep you notified about your to-dos and come in handy when you need constant updates from a third party application. So, how can you make your bot respond to a message? The bot message handler is a piece of code triggered when a message is sent to the bot. Message handlers help you customise your bot responses to make it look conversational. The message input from the user can be either a string or an option selected
Cliq Bots - Get notifications about any action on an application with the incoming webhook handler!
Webhooks can be used to get notified about events happening in other applications inside Cliq. All bots in Cliq have their own incoming webhook endpoint. This makes it simple to post messages to the bot from external applications. Unlike the send message
The Slash Command Series - Types of Command Suggestions
Hi Everybody! I hope you guys tried the /zdocs command and now have an idea of how command suggestions with click to execute work. If you have no clue of what command suggestion is, I recommend you to take a look at all the Slash Command Series posts, especially the one on Command Suggestions ! This post is all about the different types of command suggestions. Customise your command suggestions Did you know you could customise your command suggestion list with a title, description, image? Well,
Zoho TeamInbox Resources
Zoho DataPrep Resources
Zoho CRM Plus Resources
Zoho Books Resources
Zoho Subscriptions Resources
Zoho Projects Resources
Zoho Sprints Resources
Qntrl Resources
Zoho Creator Resources
Zoho Campaigns Resources
Zoho CRM Resources
Zoho Show Resources
Writer Get Started. Write Away!
Writer is a powerful online word processor, designed for collaborative work.