Configure ChatGPT in Zoho Cliq (Now with GPT-4 ⚡)

Configure ChatGPT in Zoho Cliq (Now with GPT-4 ⚡)

Updated for GPT-4 Support: The post and scripts has been revised to take advantage of the new GPT-4 model's capabilities. Please use the updated version for enhanced performance and accuracy.  

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. info message;
  2. response = Map();
  3. // Need to add openAI token
  4. token = "Bearer sk-GlHHcXXXXXXXXXXXXXXXXXXXXXXXXX";
  5. header = Map();
  6. header.put("Authorization",token);
  7. header.put("Content-Type","application/json");
  8. contentList = list();
  9. contentList.add({"role":"user","content":message});
  10. params = {"model":"gpt-4","messages":contentList,"temperature":0.9,"max_tokens":2048,"top_p":1,"frequency_penalty":0,"presence_penalty":0,"stop":{"Human:","AI:"}};
  11. // Making post request 
  12. fetchCompletions = invokeurl
  13. [
  14. url :"https://api.openai.com/v1/chat/completions"
  15. type :POST
  16. parameters:params + ""
  17. headers:header
  18. detailed:true
  19. ];
  20. info fetchCompletions;
  21. if(fetchCompletions.get("responseCode") == 200)
  22. {
  23. // Populating the response to human readable format
  24. answer = fetchCompletions.get("responseText").get("choices").toMap().get("message").get("content");
  25. info "answer" + answer;
  26. response.put("text",answer);
  27. }
  28. else if(fetchCompletions.get("responseCode") == 401)
  29. {
  30. response = {"text":fetchCompletions.get("responseText").get("error").get("message")};
  31. }
  32. else if(fetchCompletions.get("responseCode") == 429)
  33. {
  34. response = {"text":fetchCompletions.get("responseText").get("error").get("message")};
  35. }
  36. else if(fetchCompletions.get("responseCode") == 503)
  37. {
  38. response = {"text":"Service Temporarily Unavailable"};
  39. }
  40. else
  41. {
  42. response = {"text":"I dont have any knowledge in this. Please ask me something else"};
  43. }
  44. 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").
    Note: Project-based API keys from OpenAI will not work for this integration. You need to use a secret API key associated with your personal or organizational OpenAI account. 
  • 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. info data;
  5. if(data.get("message").get("type") == "text")
  6. {
  7. response = Map();
  8. // Need to add openAI token
  9. token = "Bearer sk-GlHHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
  10. header = Map();
  11. header.put("Authorization",token);
  12. header.put("Content-Type","application/json");
  13. contentList = list();
  14. contentList.add({"role":"user","content":data.get("message").get("text")});
  15. params = {"model":"gpt-4","messages":contentList,"temperature":0.9,"max_tokens":2048,"top_p":1,"frequency_penalty":0,"presence_penalty":0,"stop":{"Human:","AI:"}};
  16. // Making post request 
  17. fetchCompletions = invokeurl
  18. [
  19. url :"https://api.openai.com/v1/chat/completions"
  20. type :POST
  21. parameters:params + ""
  22. headers:header
  23. detailed:true
  24. ];
  25. info fetchCompletions;
  26. if(fetchCompletions.get("responseCode") == 200)
  27. {
  28. // Populating the response to human readable format
  29. answer = fetchCompletions.get("responseText").get("choices").toMap().get("message").get("content");
  30. response.put("text",answer);
  31. }
  32. else if(fetchCompletions.get("responseCode") == 401)
  33. {
  34. response = {"text":fetchCompletions.get("responseText").get("error").get("message")};
  35. }
  36. else if(fetchCompletions.get("responseCode") == 429)
  37. {
  38. response = {"text":fetchCompletions.get("responseText").get("error").get("message")};
  39. }
  40. else if(fetchCompletions.get("responseCode") == 503)
  41. {
  42. response = {"text":"Service Temporarily Unavailable"};
  43. }
  44. else
  45. {
  46. response = {"text":"I dont have any knowledge in this. Please ask me something else"};
  47. }
  48. return response;
  49. }
  50. }
  51. return Map();
  • Make sure to replace the token in line 10 with your Open AI 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.



    Access your files securely from anywhere


            Zoho Developer Community





                                      • Desk Community Learning Series


                                      • Digest


                                      • Functions


                                      • Meetups


                                      • Kbase


                                      • Resources


                                      • Glossary


                                      • Desk Marketplace


                                      • MVP Corner


                                      • Word of the Day


                                      • Ask the Experts



                                          Zoho Marketing Automation
                                                  • 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


                                                  Manage your brands on social media



                                                        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 CRM Resources

                                                                            • CRM Community Learning Series

                                                                              CRM Community Learning Series


                                                                            • Kaizen

                                                                              Kaizen

                                                                            • Functions

                                                                              Functions

                                                                            • Meetups

                                                                              Meetups

                                                                            • Kbase

                                                                              Kbase

                                                                            • Resources

                                                                              Resources

                                                                            • Digest

                                                                              Digest

                                                                            • CRM Marketplace

                                                                              CRM Marketplace

                                                                            • MVP Corner

                                                                              MVP Corner





                                                                                Design. Discuss. Deliver.

                                                                                Create visually engaging stories with Zoho Show.

                                                                                Get Started Now


                                                                                  Zoho Show Resources


                                                                                    Zoho Writer Writer

                                                                                    Get Started. Write Away!

                                                                                    Writer is a powerful online word processor, designed for collaborative work.

                                                                                      Zoho CRM コンテンツ






                                                                                        Nederlandse Hulpbronnen


                                                                                            ご検討中の方





                                                                                                  • Recent Topics

                                                                                                  • This user is not allowed to add in Zoho. Please contact support-as@zohocorp.com for further details

                                                                                                    Hello, Just signed up to ZOHO on a friend's recommendation. Got the TXT part (verified my domain), but whenever I try to add ANY user, I get the error: This user is not allowed to add in Zoho. Please contact support-as@zohocorp.com for further details I have emailed as well and writing here as well because when I searched, I saw many people faced the same issue and instead of email, they got a faster response here. My domain is: raisingreaderspk . com Hope this can be resolved.  Thank you
                                                                                                  • Zoho Forms Submission URL

                                                                                                    Hi Zoho, It would be great to have a URL which can take us to specific form entries. For example: https://forms.zoho.eu/ACCOUNTNAME/report/FORMNAME/records/UNIQUE-REF I currently have a use case where I want to use Zoho Flow to create a module entry in
                                                                                                  • How to disable clone record for a user?

                                                                                                    Hi, I'd like to disable clone records for some of my users in zoho crm. How can I go about doing that? Regards, CRM
                                                                                                  • How to provide recommended KB articles in the welcome message

                                                                                                    I'm new to Zoho and am looking to replicate something I did for a previous employer. I want all newly created tickets to receive an automated welcome message that includes a few recommended articles from our knowledge base. Ideally there would be a way
                                                                                                  • Dynamic integration of ZOHO CRM Data into ZOHO SHOW

                                                                                                    Hello, We are making offering with good design on ZOHO Show. A lot of data in those offerings are filled with Data present in ZOHO CRM (Account name, Name of the deal, Amount of the deal...etc). Thus could we push (in API ?) specific data from those fields
                                                                                                  • Building a form with Categories and multiple sub-categories

                                                                                                    Hello, I am completely new to Zoho and the Deluge programming language. I would like to build an easy way to lookup a set of previous orders from my order tracking sheet. What I have done so far is import my Excel order list into Zoho so it shows all
                                                                                                  • Zoho IP blocked by SpamCop 136.143.188.16

                                                                                                    Hello, I am unble to send any single email during the whole time due to the Zoho IP 136.143.188.16 being blolced by SpamCop.net Please help on this. RROR CODE :550 - spamcop.mimecast.org Blocked - see https://www.spamcop.net/bl.shtml?136.143.188.16. -
                                                                                                  • Can't sign in to Zoho using Google account

                                                                                                    Just checking if anyone else has an issue signing into Zoho with a Google account at the moment? (Have tried Zoho Books in the app on mobile and Chrome and Firefox on Windows 10 - doesn't work for the forums either). Error message appears as attache
                                                                                                  • unable to send message email outgoing blocked 554.5.1.8

                                                                                                    Hi good day to you, After migrating to a new hosting, I cannot send outgoing email, with an error message as below : unable to send message email outgoing blocked 554.5.1.8 Please kindly unblock my account, as I am in a rush to use it to work & communicate
                                                                                                  • Zoho CRM - COQL query failing with no reason

                                                                                                    Hi I'm trying to execute a COQL query but it's returning an error. Unfortunately I cannot understand where I'm wrong The query is the following;: URL: POST https://www.zohoapis.com/crm/v2.1/coql Body: { "select_query": "select id,Adjustment,Billing_City,Billing_Code,Billing_State,Billing_Street,Buyer_PO_Number,Delivery_Date,Delivery_Method,Due_Date,Grand_Total,Invoice_
                                                                                                  • SMTP Authentication error with django backend

                                                                                                    Hello I have e zoho mail id info@mindbrewers.in But when i use it for smtp it gives 535 authentication error in django website . EMAIL_USE_SSL = False EMAIL_USE_TLS = True EMAIL_HOST = "smtp.zoho.com" EMAIL_PORT = 587 EMAIL_HOST_USER = "info@mindbrewers.in"
                                                                                                  • Zoho Mail Search Engine Sucks

                                                                                                    Hello There! I really like all the features of Zoho Mail and I believe is way better than Gmail except for the Search Function. I believe Zoho Mail has a very poor search function, if you misspelled a word in the search box, Zoho Mail won't display any
                                                                                                  • No recibo correo en en mi bandeja de entrada

                                                                                                    Hola, no puedo recibir correos en mi bandeja, tengo una pagina web y puse el correo en un formulario y cuando meto los datos y los envio no me llegan , pero si pongo otra ya sea gmail, outlook si los recibo, tiene que ver con mis dns?
                                                                                                  • The sending IP (136.143.188.15) is listed on spamrl.com as a source of spam.

                                                                                                    Hi, it just two day when i am using zoho mail for my business domain, today i was sending email and found that message "The sending IP (136.143.188.15) is listed on https://spamrl.com as a source of spam" I hope to know how this will affect the delivery
                                                                                                  • desbloquear cuenta

                                                                                                    Buenos dias  Cordial saludo Tengo una cuenta libre en zoho mail asociado a un dominio, pero uno de los usuarios se bloquea el correo porque dice que ha excedido el límite de correo, por favor podrian desbloquearla y como hago para que esta persona debe enviar sus correos sin ningun probleama. Gracias de antemano
                                                                                                  • Zoho SMTP IP Addresses

                                                                                                    We are using Zoho Mail for a domain and need to whitelist some STMP IP from your service for a redirection. You can provide IP address list for Zohomail SMTP servers?
                                                                                                  • no me llegan los correos a Zoho mail

                                                                                                    No puedo recibir correos pero sí enviarlos, ya hice la modificación de MX y la verificación de teléfonos, qué es lo que ocurre? gracias
                                                                                                  • Emails being duplicated in sent items folder

                                                                                                    Since this morning, emails I send are appearing in my sent items twice (it wasn't happening before this morning) This appears to be a bug with zoho mail ... I can't see any other reason why they would appear twice.
                                                                                                  • Restrict SalesIQ Account Notifications to Admins

                                                                                                    Dear Zoho SalesIQ Team, We appreciate the continuous improvements in SalesIQ. However, we have noticed that all users, including employees who do not have admin privileges, receive certain account-related notifications—such as the recent splash screen
                                                                                                  • Email client fails to connect to IMAP & POP EU Servers for ALL users

                                                                                                    For the last couple of days, all users on my account are failing to connect to the Zoho EU mails servers. This is using mobile app on various phones & desktop mail clients on different computers. Everything works fine when using webmail & email is still
                                                                                                  • Domain Redemption Time

                                                                                                    I have a domain that is currently expired and is in the redemption period. I have already paid the redemption fee and renewal fee during the redemption period. However, there is no response and I am still being asked to pay the fees. How long will it
                                                                                                  • Same name but different email addresses

                                                                                                    Hello, I'm having a problem with managing the names of users in my organization, one of the examples in the attached screenshot shows that when i changed an email for one of the users the old email stayed but shows the correct name on top of that it also
                                                                                                  • Error opening email

                                                                                                    I just tried Zoho Mail for the first time and finished setting up my account. However, after the setup, incoming emails show an error message in the email body. Could you please help me? Thank you.
                                                                                                  • Setting up DKIM in AWS Route53

                                                                                                    Hi, AWS is not allowing me to enter the large DKIM value, which ZOHO needs me to setup for DKIM: v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCIr6rqDssUHEehaprZvNqlwBR8kGkQn4+ivpkGWSe+2qxyIBz5OE/AKUgDJLq+IoNYHiLn2hFK+RBbEWIr/5iFdurwclFID7z/QiuKxwIZcmCRq5lFf3xiWIqXwyIRTTr390LMDZdwIgJSISuogtNN/Q5Iv9gkJir/fb3OJxlgEwIDAQAB
                                                                                                  • Can send emails but cannot receive them

                                                                                                    Hello, I'm currently unable to receive emails but can send them. Checked my domain on the settings page as I thought I might have accidentally deleted a TXT file but it's saying it's valid and no option to fetch what TXT fields to do Please let me know
                                                                                                  • Recreating Zoho Account with Existing Domain

                                                                                                    Dear Zoho Support Team, Currently, I own the domain wassclothing.com, but it appears that someone has already registered this domain in Zoho Mail. As a result, I am unable to create a new Zoho Mail account using this domain. Could you please guide me
                                                                                                  • Automated Shopify adjustment problem. "An inventory adjustment has been created by the system to set the initial stock from Shopify"

                                                                                                    Has anyone noticed issues since the Shopify Sync has been updated recently? If you sync with Shopify, check to see if there are automated adjustments for old products that keep recurring. We have this problem for 6 SKU's that Zoho is doubling the stock
                                                                                                  • "Unable to scan for viruses.

                                                                                                    : Unable to scan for viruses. I've tried uploading it three times, but I keep getting the same error, which prevents me from sending an invoice. I created the PDF myself and am certain it does not contain any viruses. Are there any workarounds available?
                                                                                                  • Getting an error when trying to connect zoho mail to Make

                                                                                                    Hi, I'm trying to send an email via Make Integration. I configured the Server application and set the connection in Make Scenario. When I hit the save button I get an error from Zoho: Invalid Redirect Uri Redirect URI passed does not match with the one
                                                                                                  • Urgent: Zoho Mail Not Sending or Receiving Emails

                                                                                                    Hi Team, I am experiencing an issue with my Zoho Mail account—it is neither sending nor receiving emails. Please investigate and resolve this as soon as possible. Let me know if you need any further details. Thank you!
                                                                                                  • Zoho ToDo and MS Outlook

                                                                                                    Hi, Is there a way to create a Zoho Todo task from Outlook app or web. eg. Reading email in Outlook and need to create a task to reply on a scheduled date. Regards
                                                                                                  • Payroll Chart of Accounts Config for Dummies

                                                                                                    USA What should my COA look like for one employee, paid via a service (Gusto), no benefits. I pay her wage, associated taxes, and the Gusto monthly fee. I'd like to know the COA account type, any sub accounts, what goes where, any payment splits, etc.
                                                                                                  • Menu Bar

                                                                                                    Hi, Please guide how to change menu bar from vertical to horizontal
                                                                                                  • Create Ticket ignores a list of "secondaryContacts"

                                                                                                    Hi, we're trying to create a ticket, with a contact to be a CC. According to the documentation, it should be a list of IDs in "secondaryContacts". But when the ticket is created, it returns an empty array. Has someone tried it? Thanks for any hint. BTW
                                                                                                  • Zeptomail 136.143.188.150 blocked by SpamCop

                                                                                                    Hi - it looks like this IP is being blocked, resulting in hard bounces unfortunately :( "Reason: uncategorized-bounceMessage: 5.7.1 Service unavailable; Client host [136.143.188.150] blocked using bl.spamcop.net; Blocked - see https://www.spamcop.net/bl.shtml?136.143.188.150
                                                                                                  • EDIT MAIL DOMAIN

                                                                                                    HOW DO I EDIT MY MAIL DOMAIN
                                                                                                  • On-prem version of Zoho Desk

                                                                                                    Is there an on-prem version of Zoho Desk available for enterprise customers if we have additional aspects of security that aren't covered with current legal and data security terms?
                                                                                                  • Workers unable to submit time logs

                                                                                                    I received a phone call and an email from employees saying that they received the same error code. They cannot submit the hours that they worked. The clerk whose email is problematical is not in the office this week and does not have access to her email.
                                                                                                  • Error 550 - receiving email

                                                                                                    Hi, We've been getting messages from three different customers that our email address was bouncing. Our email address is hello[at]meteoorbooks.com. This was the error message they received: The response from the remote server was: 550 5.0.1 Recipient
                                                                                                  • solicitud cambio de dominio

                                                                                                    buenas tardes por favor me pueden ayudar con un cambio de dominio es que al crear un correo corporativo manual y agregue un dominio inscribí el mío pero le anexe letras de mas y no pude seguir con el proceso y no se como hacer para seguir con la configuración
                                                                                                  • Next Page