Location 

 

To create a single line input of type- location, define the type value as location. The list of attributes passed to the input fields are as given below. The mandatory parameters are indicated with a *.

Attribute Name

Data Type

Description

type*

String

The type of the input field. The type for the location field is "location".

placeholder*

String (100)

Sample field value displayed to the user that describes the expected value of the input field. 

name*

String (50)

A unique identifier for the form field. Upon submitting a form, the value defined for the key will be available in the function associated with the form.

label*

String (50)

Describes the display name of the field.

hint

Stirng (100)

Provides a brief description of the field's purpose and the expected input.

value*

Object

Provides three keys of the locations field's value object.
1. longitude (Mandatory) 

2. latitude (Mandatory)

3. radius (Optional)

 

Expected format of the location field is 

"13.08891" (latitude),"80.26483"(longitude), "10"(radius)

mandatory

Boolean

Defines if the form field is mandatory or not. The default value is true.

 

Syntax

 



//Sample Syntax for Bot Message Handler

response = Map();
contact = "[Contacts](https://www.zoho.com/cliq/help/contacts/)";
if(message.containsIgnoreCase("contacts"))
{
	response.put("text","That's a really good question. Why don't you take a look at our help guide on " + contact + " !");
}
else if(message.containsIgnoreCase("Hi") || message.containsIgnoreCase("Hey"))
{
	response.put("text","Hey *" + user.get("first_name") + "* ! How can I help you today?");
}
else
{
	response.put("text","I'm sorry, I am not able to help you with this question. :sad: ");
}
return response;

Using suggestions in the bot message handler 

Bot suggestions can be triggered by using the suggestions object in the bot message handler. These suggestions are prompted when a user enters a message corresponding to the text defined in your handler code. The suggestions are displayed as options, and on click from the user, the button option text is returned as a response. 

Note: A bot suggestions list can show a maximum of 10 suggestions.  

Sample structure of the suggestions object in bot message handler :

The entry map can have two parameters :

ParameterDescription
textString. Use this param to give the option text.
icon Image URL. This param can be used to give an icon/image to the option.

list = List();
entry = Map();
entry.put("text","");
entry.put("icon","");
list.add(entry);

Example 

The above-given use case can be simplified using the suggestions object in the bot message handler. 



{
  "hint": "",
  "name": "",
  "label": "",
  "placeholder": "",
  "type": "location",
  "value": "",
  "mandatory":true //boolean,  default is set true
}

Sample code