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




                                    Zoho Desk Resources

                                    • Desk Community Learning Series


                                    • Digest


                                    • Functions


                                    • Meetups


                                    • Kbase


                                    • Resources


                                    • Glossary


                                    • Desk Marketplace


                                    • MVP Corner


                                    • Word of the Day



                                        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 Campaigns 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

                                                                                                  • Bulk create tasks - Zoho Projects API

                                                                                                    Hi Zoho/Community, I am trying to create multiple tasks in a single API call, is there a way we can combine multiple request bodies into one single payload? The issue I am facing is the rate limiting on the API, I wanted to create certain amount of tasks
                                                                                                  • Task Due dates and Reminder Date & Time

                                                                                                    I like to have a reminder on many tasks in Zoho Recruit. I find the process cumbersome in that each task requires the following: 1. click and select due date 2. Click the reminder box 3. Click on (Reminder) Start Date 4. Click on (Reminder )Time If one
                                                                                                  • Unable to Access Admin Console and Email Sending Issues

                                                                                                    Hello Zoho Support Team and Community, I hope this post finds you well. I am currently facing two significant issues with Zoho services: Admin Console Access Issue: Every time I try to access the Zoho Admin Console, it gets stuck on the loading screen
                                                                                                  • Tracking new lead response time

                                                                                                    Hi, I have a team of Sales Development Reps, who have a KPI of responding to a lead within 20 mins or less once it hits the system.  I seem to recall that Zoho CRM had the capability to track this in a previous version, but don't see it anywhere.   It's
                                                                                                  • Getting The Following Error.. 550 5.4.6 Unusual sending activity detected

                                                                                                    I just launched a marketing campaign and I got this error. Everything was working fine previously. This is a big launch so need to fix it asap. Can anyone help?
                                                                                                  • Printing on 80mm bluetooth Pos Printer

                                                                                                    Hello. I am trying to print receipts and invoices using my 80mm bluetooth connectivity Pos printer. I have configured the Templates to Retail so that it matches the paper width of the Pos printer. However, when I click Print in zoho, first it opens the
                                                                                                  • Trying to integrate gmail but google keeps blocking Zoho access for integration??

                                                                                                    hi i am trying to integrate a gmail account so can track/access business emails this way. I have followed the instructions but after selecting my email account it gets re-routed to this message (screengrab below) Can anyone advise a way around this or
                                                                                                  • Which attribute in Zoho books invoice api represent branch attached to the invoice?

                                                                                                    Hi Zoho Team, We have done the integration with Zoho Books API. While fetching data from Invoice API we want to get branch value attached to the invoice. We could not figure out which field in "Get an Invoice" api represents branch value attribute. Thanks
                                                                                                  • How to Billed from two different GST Numbers

                                                                                                    How to Billed from two different GST Numbers. Suppose ABC & Co had GST registration in Delhi and Haryana and Zoho account is created with Delhi GST Registration number. Now i also want to issue invoice from Haryana GST Registration number. How can i proceed ?
                                                                                                  • How to hide Predefined views

                                                                                                    Hi, I would like to know how to hide: Predefined views and Recent views or some records from this list. If I'm using it form iPad I have to scroll to see User created views. Or maybe it's possibility to move User created views on the top. All the best,
                                                                                                  • Deleting Views

                                                                                                    How do you delete views? Please syd
                                                                                                  • Fixed Assets

                                                                                                    Where would I manage my fixed assets
                                                                                                  • Report on Assets

                                                                                                    Hi,  Is it possible to report purchased assets on a specific year? The Balance Sheet shows everything up to the current date, and the expense reports will not show purchased assets because they are assets not expenses. If it is not possible, then is it possible to setup an API connection with Books to extract data from to another Reporting application?
                                                                                                  • Purchase of Fixed Assets

                                                                                                    How can I record the purchase of assets using zoho books? For example, I purchased 4 laptop for 100000 $ each and paid it through my bank account. How can I record this transaction and maintain track of how much of the assets I bought?
                                                                                                  • Where is the Fixed Asset Register?

                                                                                                    I am a Zoho One user for 18 months, using invoicing and CRM and now ready to migrate my books to Zoho Books. Where do I keep the fixed asset register for the equipment that I use in my business? I have a service based business with a lot of gear and business
                                                                                                  • Kaizen #168 - Incremental Authorization

                                                                                                    Welcome to this week's post in the Kaizen series. In this post, we will discuss Incremental Authorization. What is Incremental Authorization? Incremental Authorization is an OAuth strategy that allows a client to request specific authorization scopes
                                                                                                  • Configure Notes Title for Blueprint Transition

                                                                                                    It'd be very helpful to be able to configure note titles on blueprint transitions when requiring notes. This would help tie back the history of notes to the blueprint actions. We have some approval processes in our blueprint and require notes for the
                                                                                                  • An update to improve email delivery | Email Authentication & Relay

                                                                                                    Dear Zoho Recruit Community, We hope this message finds you well. This post is to inform you about an important update regarding the authentication of all email domains in your Zoho Recruit account. Effective 31st December, 2024, emails sent using email
                                                                                                  • Stop adding Default ID column to xls exports

                                                                                                    When anything is exported to xls, Zoho adds a column with an ID.  WE DO NOT WANT THIS COLUMN.  We use an automated report to a team.  We have our own tracking number.  1. This makes the report messy, it just pushes OUR data off to the right.  2. We have
                                                                                                  • Zoho cases and remote work api

                                                                                                    How to use zoho cases listing api? When i try to hit the endpoint specified in the docs , i get the error : the page you are looking for does not exist with a 401.
                                                                                                  • Calendly does not show scheduled Meetings

                                                                                                    I use Calendly as my standard booking tool, but no matter what I am doing, Calendly shows any appointment as free (when in fact there already is an appointment in CRM Calendar or Zoho Calendar). Drives me nuts - cannot go away from Calendly due to various
                                                                                                  • I want the currency in my account to be Mexican pesos.

                                                                                                    Hello, I am a Mexican citizen and live in Ukraine. When I registered to your system, it was seen that I was from Ukraine, so the default currency is Euro. This is causing me a problem. Please change the standard currency in my account to Mexican Pes
                                                                                                  • Year-End Wrap: Don't rewrite - Switch to Email Templates

                                                                                                    As we're half-way through December, now is the perfect time to start sending out festive greetings. Whether it is to your clients or your team, it is important that every mail is tailored to the recipient and feels genuine, which allows you to make better
                                                                                                  • Elevating Email Security on Zoho Desk: DKIM Now Mandatory

                                                                                                    Hello Zoho Desk Users! It has been a wonderful journey with you on Zoho Desk. As we prepare to welcome 2025, we are strengthening our efforts to ensure a secure and seamless experience for you. To enhance email security, DKIM configuration will be mandatory
                                                                                                  • How to view shared mailbox in Outlook

                                                                                                    How to view shared mailbox in Outlook or in another software
                                                                                                  • Necesito el código ZB para mi cuenta

                                                                                                    Hice cambio de servidor y no encuentro el codigo unico de cname.
                                                                                                  • Privacy error

                                                                                                    Privacy error on Chrome for all embedded forms and reports, this is a huge issue: "Your connection is not private Attackers might be trying to steal your information from creator.zohopublic.com (for example, passwords, messages, or credit cards). NET::ERR_CERT_COMMON_NAME_INVALID"
                                                                                                  • Automate Backups

                                                                                                    This is a feature request. Consider adding an auto backup feature. Where when you turn it on, it will auto backup on the 15-day schedule. For additional consideration, allow for the export of module data via API calls. Thank you for your consideration.
                                                                                                  • Customise Search Bar in CRM

                                                                                                    Is there a way to customise this search bar in the CRM to add fields?
                                                                                                  • Counting downloads of a file

                                                                                                    Hello Could anyone help me, I would like to use a custom script to count how many times a file contained in a record has been downloaded. Is that something that is possible in Creator? Thanks Estelle
                                                                                                  • Is there any way to prevent emails from being sent from zoho crm without pressing email opt out?

                                                                                                    When I left my desk yesterday I excitedly thought I had fixed my problem, by making use of the "Inactive" field ... However after contacting the support chat, they have advised to stop emails being sent I need to update the "Email Opt Out" field - which
                                                                                                  • New Search Function

                                                                                                    Hey Team, The search function updated in our CRM about a week ago, so I assume it was an automated update across Zoho. It no longer displays leads/deals etc in Chronological order so that the most recently created or updated is the first to display which
                                                                                                  • New permissions for accessing emails sent via Zoho CRM

                                                                                                    Last modified on Nov 4, 2024: Permissions for accessing emails sent via Zoho CRM have now been extended to the IN DC. With this rollout, the feature is now available to all users across all DCs. Resources: Data sharing for emails, Configuring email compose
                                                                                                  • is it possible to add more than one Whatsapp Phone Number to be integrated to Zoho CRM?

                                                                                                    so I have successfully added one Whatsapp number like this from this User Interface it seems I can't add a new Whatsapp Number. I need to add a new Whatsapp Number so I can control the lead assignment if a chat sent to Whatsapp Phone Number 1 then assign
                                                                                                  • Request for Alerts on Workflow and Function Changes.

                                                                                                    I want to get an alert whenever a new workflow or function is added or an existing workflow or function is edited. Is there any way to do that? I need to log all changes whenever updates are made or new ones are added.
                                                                                                  • Transfer Amount from One Vendor to Another Vendor

                                                                                                    One of the vendors, who has a balance with us, has closed the business and has started a new business; Now he wants me to transfer the outstanding from the old account to the new Vendor Account. I am trying to do this using Payment Settlement a/c, But
                                                                                                  • How to make Branch compulsory in Zoho Books invoice?

                                                                                                    How I make Branches compulsory in Zoho Books invoice?
                                                                                                  • Regarding GST Report Issue in Zoho Books

                                                                                                    Hi, Right now, the very important point from my end is this Zoho Books issue. Here, you can see that we have created the invoice with the items of account sales and expenses. The journal is also correct. The profit and Loss statement is also correct.
                                                                                                  • Default Ship To Address on Purchase Orders cannot be different than Organization Address

                                                                                                    Our organization address is not where we want shipments delivered, it is just a mailing address. We would like to change the Ship To address on our PO's so that by default it is our warehouse (not the mailing address). I understand that when creating
                                                                                                  • Function #57: Automatically group items in invoices based on categories

                                                                                                    Hello everyone, and welcome back to our series! As a business expands and new product lines are launched, it becomes important to organize the items for better inventory management. The Category field in Zoho Books helps here by allowing you to add and
                                                                                                  • Next Page