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



                                                          • Sticky Posts

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


                                                          Manage your brands on social media



                                                                Zoho TeamInbox 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

                                                                                            Get Started. Write Away!

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

                                                                                              Zoho CRM コンテンツ






                                                                                                Nederlandse Hulpbronnen


                                                                                                    ご検討中の方




                                                                                                          • Recent Topics

                                                                                                          • Ask the Experts: Five-hour live Q&A session with Zoho WorkDrive product experts

                                                                                                            Have questions about WorkDrive 5.0? Let’s talk! We recently launched Zoho WorkDrive 5.0, packed with powerful updates to help your team work smarter, stay secure, and get more value from your business content. From content-centric workflows and AI-powered
                                                                                                          • External download link limit

                                                                                                            Can You please help us to understand this For Zoho WorkDrive external users, the download limit is a maximum of 5 GB total download size and a maximum of 50 first-level files and folders What is the meaning of first level? We are using these files in
                                                                                                          • Dynamically catching new file creations

                                                                                                            I have a team folder with many subfolders, and in those folders we add new documents all the time. I'd like to have a workflow or script to notify me (and then take other actions) when a file is added anywhere in that structure that ends in "summary.txt".
                                                                                                          • Rotate an Image in Workdrive Image Editor

                                                                                                            I don't know if I'm just missing something, but my team needs a way to rotate images in Workdrive and save them at that new orientation. For example one of our ground crew members will take photos of job sites vertically (9:16) on his phone and upload
                                                                                                          • Workflow workdrive rollout

                                                                                                            Hi! When will workflow be rolled out to all users? Thanks.
                                                                                                          • Sync desktop folders instantly with WorkDrive TrueSync (Beta)

                                                                                                            Keeping your important files backed up and accessible has never been easier! With WorkDrive desktop app (TrueSync), you can now automatically sync specific desktop folders to WorkDrive Web, ensuring seamless, real-time updates across devices. Important:
                                                                                                          • 🚀 WorkDrive 5.0: Evolving from a file sharing app to an intelligent content management platform: Phase 2

                                                                                                            Hello everyone, WorkDrive's primary focus has always been to provide an intelligent and secure content management platform, simplify collaboration, and be the central repository of files for all Zoho apps. In our previous announcement, we unveiled the
                                                                                                          • Creating and managing a Team Folder using WorkDrive TrueSync

                                                                                                            Hello everyone, Are you tired of constantly switching between your Desktop TrueSync app and the WorkDrive web app to create and manage Team Folders? We’ve made things easier for you. You can now create and manage Team Folders directly within the TrueSync
                                                                                                          • Live webinar: Getting the most out of WorkDrive in Zoho Workplace

                                                                                                            Hello everyone, We’re excited to invite you to our upcoming live webinar, where we’ll explore how to maximize your use of WorkDrive as part of the Zoho Workplace bundle. This is a fantastic opportunity to elevate your productivity and streamline your
                                                                                                          • Edit images seamlessly with WorkDrive's built-in Image Editor

                                                                                                            Are you tired of switching between multiple tools just to make simple edits to your images? We understand the hassle, which is why Zoho WorkDrive now comes with a built-in image editing tool, powered by Zoho Annotator. This tool allows you to edit images
                                                                                                          • Supercharge your email workflow with WorkDrive's add-in for Microsoft Outlook

                                                                                                            Consider this: You’re handling a critical project, and your inbox is packed with important attachments, email threads, and client communications. The back-and-forth routine of downloading files to your computer, uploading them to WorkDrive, and manually
                                                                                                          • Secure and promote your content with Custom Watermarking

                                                                                                            Imagine this: You’re a professional photographer who regularly shares your work online with potential clients and collaborators. Recently, you notice that some of your images have been reposted without any credit or permission. This not only impacts your
                                                                                                          • Live webinar: Explore WorkDrive's seamless integrations with key Zoho apps

                                                                                                            Hello everyone, We’re excited to invite you to our upcoming live webinar, where we'll delve into the seamless integration of WorkDrive with other key Zoho applications! This is a fantastic opportunity to enhance your productivity and streamline your workflows
                                                                                                          • Join us in Singapore for the Zoho WorkDrive User Group meetup!

                                                                                                            Hello, everyone! Exciting news! We'll be hosting an upcoming Zoho WorkDrive user group meetup in the beautiful city of Singapore this November. At this Zoho User Group meetup, we'll guide you through ways to use WorkDrive as a platform and build custom
                                                                                                          • WorkDrive TrueSync now supports ARM64-based Windows devices!

                                                                                                            We’re excited to announce that the Zoho WorkDrive TrueSync app now fully supports Windows devices with ARM64 architecture! Whether you're working on an ARM-based device or an x64 processor, you can now enjoy the same seamless file synchronization experience
                                                                                                          • Live webinar: 2024 recap of Zoho WorkDrive

                                                                                                            Hello everyone, We’re excited to invite you to our year-end live webinar! This session will take you through the transformative features and updates we’ve introduced in Zoho WorkDrive this year, helping you streamline document management like never before.
                                                                                                          • Option to Disable Download for Documents Shared via Permalink

                                                                                                            Dear Zoho Writer Team, Currently, when sharing a Writer document using the regular permalink (Collaborators with external users), there is no option to restrict the ability to download the document. While the external share link allows such restrictions,
                                                                                                          • Live Webinar: Optimizing back-office operations in the manufacturing industry to maximize profitability

                                                                                                            Hello everyone, We’re excited to invite you to our upcoming live webinar on February 6! Discover how Zoho WorkDrive can help manufacturing businesses optimize back-office operations, improve efficiency, and boost profitability. Our product experts will
                                                                                                          • Important update for WorkDrive TrueSync users in China Data Center (CN DC) & Chinese language users in other DCs

                                                                                                            Dear WorkDrive TrueSync users, We recently identified an issue affecting users who have set their WorkDrive TrueSync app language to Chinese (Simplified/Traditional). During the auto-update process, the app would not restart automatically and unexpectedly
                                                                                                          • Live webinar: Streamlining legal operations: Leveraging Zoho WorkDrive for law firm success

                                                                                                            Hello everyone, Managing legal documents across departments and jurisdictions can be complex, but it doesn’t have to be. Join us on March 6 for an exclusive webinar where we’ll show you how Zoho WorkDrive empowers legal teams to stay compliant, organized,
                                                                                                          • Calendar not working

                                                                                                            Are we the only ones. On any browser we cannot click on any of our calendar appointments and get them to open. They just make the browser loop. WE have reached out and have been told they are working on it. The office staff are really stuck. The point
                                                                                                          • [Live Webinar] New in Zoho WorkDrive: AI enhancements, Data Loss Prevention, Version Controls, and more

                                                                                                            Hello everyone, We're excited to bring you another round of powerful updates in Zoho WorkDrive! Join us on May 15 for an exclusive live webinar where we’ll unveil the latest features designed to enhance your team’s productivity, collaboration, and data
                                                                                                          • How to Download a File from Zoho WorkDrive Using a Public Link

                                                                                                            How to Download a File from Zoho WorkDrive Using a Public Link If you're working with Zoho WorkDrive and want to download a file using a public link, here's a simple method to do so using API or a basic script. This approach helps developers or teams
                                                                                                          • WorkDrive TrueSync for macOS 26 (Tahoe) Beta

                                                                                                            Hello everyone, With Apple unveiling the macOS 26 (Tahoe) Beta, we know many of you are eager to explore the latest features and enhancements. We’re excited to support your enthusiasm! As part of our commitment to delivering seamless cross-platform experiences,
                                                                                                          • domain not verified error

                                                                                                            Hi when i try to upload a video from zoho creator widget to zoho work drive iam getting domain not verified error.I don't know what to do .In zoho api console this is my home page url https://creatorapp.zoho.com/ and this is my redirect url:www.google.com.Iam
                                                                                                          • Live Webinar: Getting Started with Zoho WorkDrive - A Complete Overview

                                                                                                            Hello everyone, We’re excited to invite you to our upcoming live webinar! Discover how to set up your team, bring in your data, and make the most of WorkDrive’s collaboration, organization, AI, and security capabilities. This session is perfect for anyone
                                                                                                          • Calendly One-way sync- Beta Access

                                                                                                            Hello Community, Many of our Zoho Calendar users have expressed their interests in Zoho Calendar and Calendly integration. We've been tightly working on with Calendly team to provide a two-way sync between Calendly and Zoho Calendar. However, there have
                                                                                                          • The year that was at Zoho Calendar 2023- Part 2

                                                                                                            In continuation with our previous post on all the exciting updates and improvements that have shaped Zoho Calendar over the past 12 months, Lets delve into more: Bring your calendars together- Introducing Zoho Calendar and Outlook calendar synchronisation
                                                                                                          • Tip of the week #18: Change the event organizer in Zoho Calendar.

                                                                                                            We cannot always be available to conduct an event when we organise one. In these circumstances, you can use Zoho Calendar to change the event organizer at any moment before the event begins. This way, you can avoid cancelling the event while still taking
                                                                                                          • Tip of the week #20: Create and manage multiple personal calendars.

                                                                                                            Zoho Calendar provides users with the facility to create and manage as many calendars as required. All these calendars can be managed and edited as per user requirements. You can alter the calendar view, make changes to the calendar theme, share the calendar
                                                                                                          • Tip of the week #24: Subscribe to the calendars of a Zoho Calendar user.

                                                                                                            Calendars that are created by Zoho Calendar users can also be added to your Zoho calendar. All public calendars listed by the users will be available when you enter the email address. You can choose the calendar you need to subscribe to. Once the email
                                                                                                          • Tip of the week #26: Import/ Export calendars in Zoho Calendar.

                                                                                                            Any calendar on the web or calendars that you create in any other calendar application can be imported in to Zoho Calendar. This will help you to add the events from the calendars that you import to your Zoho Calendar. You also have the option to export
                                                                                                          • Removing calendar for zoho email group

                                                                                                            How do I make it so that an email group created in Zoho Mail does NOT have a calendar? I have a couple groups for our phone systems voicemails - one for each department. Voicemail recordings are sent to this groups email address so they have access to
                                                                                                          • Tip of the week #27: Edit personal calendars in Zoho Calendar.

                                                                                                            In Zoho Calendar, the personal calendars you create can be edited to make changes you need to make. Edit a Personal Calendar The following changes can be made to the personal calendar by editing it: Calendar title Calendar color Reminders and Description
                                                                                                          • Tip of the week #28: Show/ hide, enable/ disable and empty/ delete your calendars in Zoho Calendar.

                                                                                                            The popularity of online calendars has soared in recent years. It's used both for personal and professional reasons. Calendars have evolved into an effective productivity tool in our lives, from creating events for birthdays and anniversaries to scheduling
                                                                                                          • Tip of the week #30: Share calendars publicly in Zoho Calendar.

                                                                                                            In Zoho Calendar, calendars that are created under My Calendars can be shared publicly. Making your calendar public allows others to view it. When you need to share your calendar with a larger group, public sharing can help. You can restrict others from
                                                                                                          • Tip of the week #31: Share your personal calendars within organization.

                                                                                                            Keep your Organization members aware of what's happening. In Zoho Calendar, you can share your personal calendar with all the members in your organization using the Share with org option.When you enable org sharing for a particular personal calendar,
                                                                                                          • Tip of the Week #33: Appointment scheduler in Zoho Calendar.

                                                                                                            In Zoho Calendar, you can use the Schedule Appointment option to share your appointment request form with the public, allowing people to fill out the form to request an appointment with you. This form can be embedded on your website or blog. Visitors
                                                                                                          • Tip of the Week #34: Embed Calendars using Zoho Calendar

                                                                                                            You can make your calendars public and visible to the general public by embedding them in your websites/blogs using Zoho Calendar. You can use the embed code to add your own calendars to your website's/ blog's HTML code, and the calendar will appear on
                                                                                                          • Tip of the week #35: Migrate to Zoho Calendar from Google Calendar.

                                                                                                            If you are looking to move your Google Calendar events to Zoho Calendar, never worry about missing out the events from your Google Calendar. You can migrate the events from Google Calendar using the export option and import it to Zoho Calendar and manage
                                                                                                          • Next Page