🟨Add to Zoho

How to add your AskAI to your Zoho chatbot in 3 steps

For an example of this in action, check out: www.breadpartners.com

  1. Create a plugin in SalesIQ in the developer section.

  2. Follow these instructions but modify the script like this:

First Plug Named "MyAskAIContextualA":


if(session.containsKey("question"))
{
	question = session.get("question").get("value");
}
//replace the token with your API key | token = "Bearer [your API key]";
param_body = Map();
param_body.put("id","Insert ID");
param_body.put("api_key","Insert API_Key");
new_list = list();
param_body.put("messages",new_list);
// if(question = null)
// {
// 	question = loopquestion;
// }
data = Map();
// if(contaxt != null)
// {
// 	me = contaxt.toList();
// 	for each  elem in me
// 	{
// 		new_list.add(elem);
// 	}
// }
data.put("role","user");
data.put("content",question);
new_list.add(data);
//info param_body;
headerMap = Map();
headerMap.put("Content-Type","application/json");
//info zoho.currenttime.toLong();
response_info = invokeurl
[
	url :"https://myaskai.com/api/1.1/wf/ask-ai-chat"
	type :POST
	parameters:param_body.toString()
	headers:headerMap
];
//info param_body;
answer = response_info.get("answer");
data2 = Map();
data2.put("role","assistant");
data2.put("content",answer);
new_list.add(data2);
new_list = new_list.toString();
//info answer;
response = Map();
response.put("answer",answer);
response.put("chatbotresponse",new_list);
return response;


Parameters set in Zoho Plug
Input:
question (string)

Output:
answer (string)
chatbotresponse (string)


Second Plug Named "MyAskAIContextualC":

if(session.containsKey("loopquestion"))
{
	loopquestion = session.get("loopquestion").get("value");
}
if(session.containsKey("context"))
{
	context = session.get("context").get("value");
}
info context;
info loopquestion;
//replace the token with your API key | token = "Bearer [your API key]";
param_body = Map();
param_body.put("id","Insert ID");
param_body.put("api_key","Insert Api_Key");
new_list = list();
param_body.put("messages",new_list);
question = loopquestion;
data = Map();
if(context != null)
{
	me = context.toList();
	for each  elem in me
	{
		new_list.add(elem);
	}
}
data.put("role","user");
data.put("content",question);
new_list.add(data);
//info new_list;
//info param_body;
headerMap = Map();
headerMap.put("Content-Type","application/json");
response_info = invokeurl
[
	url :"https://myaskai.com/api/1.1/wf/ask-ai-chat"
	type :POST
	parameters:param_body.toString()
	headers:headerMap
];
info param_body;
answer = response_info.get("answer");
info answer;
data2 = Map();
data2.put("role","assistant");
data2.put("content",answer);
new_list.add(data2);
info new_list;
data2 = new_list.toString();
response = Map();
response.put("context",data2);
response.put("chatbotresponse",data2);
response.put("answer",answer);
return response;

Parameters set in Zoho Plug
Input:
Context (string)
Loopquestion (string)

Output:
context (string)
answer (string)
chatbotresponse (string)
  1. Follow the steps in this video:

Last updated