Configure ChatGPT in Zoho Cliq

Configure ChatGPT in Zoho Cliq

If you have been on the internet for the past few months, you have probably heard of ChatGPT. It has been making waves across the world as the next big technological revolution in artificial intelligence. ChatGPT is an advanced language model developed by OpenAI. It uses deep learning techniques and is trained on a massive amount of data to generate human-like responses to text inputs. With its ability to understand context, recognize patterns and relationships, and generate natural language, ChatGPT is capable of providing informative and engaging answers to a wide range of questions on diverse topics.

According to a recent PWC report, 67% of business executives think integrating AI into their business will greatly improve performance and efficiency. You can also integrate ChatGPT into Cliq by following these easy steps:
  • Create a bot with channel participation permission (make sure to check the options for the bot to "send messages" and "listen to messages" in the sub actions)
  • Go to Profile -> Bots & tools -> Bots -> Create Bot -> Enter the name, description and enable channel participation -> Save.
A helpful rule of thumb is that one token generally corresponds to ~4 characters of text for common English text. This translates to roughly ¾ of a word (so 100 tokens ~= 75 words).

Message Handler:

If you want to ask questions to the bot in a one-on-one chat directly, you will have to modify the message handler. To do that, follow these steps:
  • Navigate to the message handler and click on Edit Code. Now copy the below code and paste it.
  1. response = Map();
  2. question = message;
  3. // Need to add openAI token
  4. token = "Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxx";
  5. header = Map();
  6. header.put("Authorization",token);
  7. header.put("Content-Type","application/json");
  8. params = {"model":"text-davinci-003","prompt":question,"temperature":0.9,"max_tokens":256,"top_p":1,"frequency_penalty":0,"presence_penalty":0,"stop":{" Human:"," AI:"}};
  9. // Making post request 
  10. fetchCompletions = invokeurl
  11. [
  12.      url :"https://api.openai.com/v1/completions"
  13.      type :POST
  14.      parameters:params.toString()
  15.      headers:header
  16.      detailed:true
  17. ];
  18. if(fetchCompletions.get("responseCode") == 200)
  19. {
  20.      // Populating the response to human readable format
  21.      answer = fetchCompletions.get("responseText").get("choices").getJSON("text");
  22.      info "answer" + answer;
  23.      response.put("text",answer);
  24. }
  25. else if(fetchCompletions.get("responseCode") == 429)
  26. {
  27.      response = {"text":fetchCompletions.get("responseText").get("error").get("message")};
  28. }
  29. else if(fetchCompletions.get("responseCode") == 503)
  30. {
  31.      response = {"text":"Service Temporarily Unavailable"};
  32. }
  33. else
  34. {
  35.      response = {"text":"I dont have any knowledge in this. Please ask me something else"};
  36. }
  37. return response;
  • Then navigate to this link and generate a token in openAI and then replace the token in line 4 (It should look something like this : "Bearer sk-K4ilep5NLxxxxxxxxxxxxxxxxxxxxxxxxxxx").
  • Save the message handler. Now the bot is ready to answer your questions.

Participation Handler:

If you want to add the bot to a channel so it can answer questions from any participants, you will have to modify the participation handler. To do that, follow these steps:
  • Add the bot to the required channel.
  • Navigate to the bot participation handler and click on Edit Code. Now copy the below code and paste it.
  1. response = Map();
  2. if(operation == "message_sent")
  3. {
  4.  if(data.get("message").get("type") == "text")
  5. {
  6. response = Map();
  7.   question = data.get("message").get("text");
  8.      // Need to add openAI token
  9.   token = "Bearer XXXXXXXXXXXXXXXXX";
  10.   header = Map();
  11.   header.put("Authorization",token);
  12.   header.put("Content-Type","application/json");
  13.   params = {"model":"text-davinci-003","prompt":question,"temperature":0.9,"max_tokens":256,"top_p":1,"frequency_penalty":0,"presence_penalty":0,"stop":{" Human:"," AI:"}};
  14.      // Making post request 
  15.   fetchCompletions = invokeurl
  16.   [
  17.   url :"https://api.openai.com/v1/completions"
  18.   type :POST
  19.   parameters:params.toString()
  20.   detailed : true
  21.   headers:header
  22.   ];
  23.   if(fetchCompletions.get("responseCode") == 200)
  24.   {
  25.           // Populating the response to human readable format
  26.   answer = fetchCompletions.get("responseText").get("choices").getJSON("text");
  27.   info "answer" + answer;
  28.   response.put("text",answer);
  29.   }
  30.      else if(fetchCompletions.get("responseCode") == 429)
  31.      {
  32.           response = {"text":fetchCompletions.get("responseText").get("error").get("message")};
  33.      }
  34.      else if(fetchCompletions.get("responseCode") == 503)
  35.      {
  36.           response = {"text":"Service Temporarily Unavailable"};
  37.      }
  38.      else
  39.      {
  40.           response = {"text":"I dont have any knowledge in this. Please ask me something else"};
  41.      }
  42.  }
  43. }
  44. return response ;
  • Make sure to replace the token in line 9 with your openAI token. 
  • Save the bot participation handler. That's it. You can now ask questions directly to the ChatGPT Bot in the configured channel without leaving Cliq.
Note: It should be noted that, if you want to use the bot at the organization/team level, it's better to use connections so each user can use their own openAI account instead of all the queries going through a single openAI account token. This approach can be beneficial as it can prevent one user's actions from negatively impacting the entire team's access to the API.




      • Sticky Posts

      • New in Zoho Chat: Threaded conversation at its finest best

        Perform effective team communication in Zoho Chat with our new 'Reply' option.   Converse and stay focussed on the parent conversation, rather than getting entangled in the web of several, never-ending sub threads.   To reply to a certain message, all you need to do is hover to the left hand side of the message. Then, click on the three dots to open a pop up menu. Here, click on the Reply button and type the reply to the message in the compose box and press Enter.   Voila, that was pretty simple. 
      • Changes in Cliq iOS app notification due to iOS 13 and Xcode 11

        Hello everyone! With the iOS 13 update, Apple has updated its policy on usage of VoIP push notifications. Over the past few months, we tried our best to provide a similar experience with the updated policy.  Changes in iOS 13:  With iOS 13, Apple mandates all VoIP push notifications to be reported to the CallKit framework as a new call. If a VoIP push notification is not reported to the CallKit within a designated time window, iOS will terminate the app. If enough VoIP push notifications are not
      • What's new in Zoho Cliq - June 2020 updates

        Hello again, everyone! I'm back to share with you the recent feature improvements and updates that we've pulled together for enhancing your experience in Cliq. Here's what's new this June for you all in Cliq's web and iOS app! New on Cliq Web: Drag and drop files to a chat in your left side panel   Now you can drag and drop attachments from your open conversation window to a specific chat or channel in the left side menu without opening it. Swift up actions and collaborate efficiently with Cliq's
      • 4 Things You Should Do Once You Get Started with Cliq

        Hey there, new user!  You've successfully logged in and set up your organization and you're all set to start working. What's next? Buckle up because here are 4 essential things you need to do first in order to get the most out of your Cliq experience:   1. Invite your colleagues   Now that you've set up your Cliq for business, you need to bring in all your employees, of course, because how else can you collaborate with them?   To invite your colleagues to Cliq, head on over to the Admin Panel which
      • New in Zoho Chat : Search for contacts, files, links & conversations with the all new powerful 'Smart Search' bar.

        With the newly revamped 'Smart Search' bar in Zoho Chat, we have made your search for contacts, chats, files and links super quick and easy using Search Quantifiers.   Search for a contact or specific conversations using quantifiers, such as, from: @user_name - to find chats or channel conversations received from a specific user. to: @user_name - to find chats or channel conversations sent to a specific user. in: #channel_name - to find a particular instance in a channel. in: #chat_name - to find