openapi: 3.0.0
info:
  title: Messages
  description: |
    The messaging API lets you post messages to a channel, a user, or a bot. The message structure can be simple, consisting of just text, or customized as cards to serve various purposes.
    You can access messaging APIs through three different methods:
    <br>
      <ol>
        <li>OAuth Scope: The OAuth scope for messaging APIs is Webhooks. All messaging APIs can be accessed using this same scope.</li>
        <li>Deluge Tasks: You can use the following Deluge functions:
          <ul>
            <li>zoho.cliq.postToChat</li>
            <li>zoho.cliq.postToChannel</li>
            <li>zoho.cliq.postToBot</li>
          </ul>
        </li>  
        <li>Auth Token: Access can also be granted using an auth token.Click <a href="https://www.zoho.com/cliq/help/restapi/v2/#creating-auth-token" target="_blank">this link</a> to know how to create an authtoken.</li>
      </ol>
  contact: {}
  version: 1.0.0
externalDocs:
  description: Find out more about Zoho Cliq APIs V2
  url: https://www.zoho.com/cliq/help/restapi/v2/
servers:
  - url: https://cliq.zoho.com/api/v2
    description: Zoho Cliq US DC
tags:
  - name: messages
    description: Messages Module
paths:
  /chats/{CHAT_ID}/messages:
    get:
      summary: Get Messages
      operationId: Get Messages
      description: |
        Retrieves messages from a chat conversation that the user has access to.
        <br><br> 
        <p>
          <b>Threshold limit</b>: 15 requests per min per user<br>
          Number of API calls allowed within a minute.<br><br>
          <b>Lock period</b>: 10 minutes<br>Wait time before consecutive API requests.<br>
        </p>
      parameters:
        - name: CHAT_ID
          in: path
          required: true
          schema:
            type: string
          example: CHAT_ID
          description: The ID of the chat from which messages are retrieved To learn how to retrieve this ID, see <a href="/cliq/help/restapi/v2/glossary/#CHAT_ID">CHAT_ID</a> in the Glossary page.
        - name: fromtime
          in: query
          required: false
          schema:
            type: integer
            format: int64
          description: Time from when you want to retrieve messages from the chat. From time should be passed in milliseconds.
        - name: totime
          in: query
          required: false
          schema:
            type: integer
            format: int64
          description: Time till when you want to retrieve messages from the chat. To time should be passed in milliseconds.
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            default: 100
          description: The number of messages to be retrieved. If limit is not specified, <b>maximum of 100 messages</b> will be retrieved.
      responses:
        '200':
          description: The request was successfully completed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/get-messages-response'
        '400':
          description: Bad Request.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The request cannot be performed. Usually because of malformed parameter or missing parameter.
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Request was rejected because of invalid AuthToken.
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The user does not have enough permission or possibly not an user of the respective organization to access the resource.
        '404':
          description: Invalid URL.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The URL you've sent is wrong. It's possible that the resource you've requested has been moved to another URL.
        '405':
          description: Method Not Allowed.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The requested resource does not support the HTTP method used. For example, requesting List of all customers API with PUT as the HTTP method.
        '406':
          description: Not Acceptable.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The response has been received but the requested response type is not supported by the browser.
        '429':
          description: Too many requests.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Too many requests within a certain time frame.
        '500':
          description: Internal Server Error.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Cliq server encountered an error which prevents it from fulfilling the request.
      security:
        - Cliq_Auth:
            - ZohoCliq.Messages.READ
      tags:
        - messages
  /channelsbyname/{CHANNEL_UNIQUE_NAME}/message:
    post:
      summary: Post message in a channel with CHANNEL_UNIQUE_NAME
      operationId: Post message in a channel with CHANNEL_UNIQUE_NAME
      description: |
        <p>
          Use this API to post a message in a channel by giving the channel's unique name in the request URL, followed by the message object containing plain text or message card.<br><br>
          You can also send a message in a Cliq channel using the following alternative endpoint:<br><br>
          <a href="/messages/#post-message-in-a-channel-with-channel-id"><code>POST /channels/{CHANNEL_ID}/message</code></a> - Use this endpoint to post a message in a channel using its channel ID.<br><br>
          Furthermore, you can specify the <code>bot_unique_name</code> query parameter in either of the above endpoints to post a message as a bot in the channel.<br><br>
          <b>Deluge task to post a message in a channel</b>:<br>
          <a href="https://www.zoho.com/deluge/help/cliq/post-to-channel.html" target="_blank"><code>zoho.cliq.postToChannel({CHANNEL_UNIQUE_NAME},message);</code></a><br><br>
          <b>Threshold limit</b>: 50 requests per min per user<br>
          Number of API calls allowed within a minute.<br>
          This limit is per user, not per token — even if messages are sent using multiple OAuth tokens by the same user, all requests count toward this shared limit.<br><br>
          <b>Lock period</b>: 10 minutes<br>Wait time before consecutive API requests.<br>
        </p>
      parameters:
        - name: CHANNEL_UNIQUE_NAME
          in: path
          description: Unique name of the channel.<br>To learn how to retrieve this ID, see <a href="/cliq/help/restapi/v2/glossary/#CHANNEL_UNIQUE_NAME">CHANNEL_UNIQUE_NAME</a> in the Glossary page.
          required: true
          schema:
            type: string
          example: CHANNEL_UNIQUE_NAME
        - name: bot_unique_name
          in: query
          description: Use this parameter to send a message in a channel as a bot. Note that the bot should already be a participant in the channel.
          required: false
          schema:
            type: string
        - name: mark_as_read
          in: query
          description: Use these APIs to mark the sent message as read for the user. By default, the message will be unread for the message posted by the user.
          required: false
          schema:
            type: boolean
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/post-message-in-a-channel-request'
      responses:
        '200':
          description: The request was successfully completed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/post-message-in-a-channel-response'
        '400':
          description: Bad Request.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The request cannot be performed. Usually because of malformed parameter or missing parameter.
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Request was rejected because of invalid AuthToken.
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The user does not have enough permission or possibly not an user of the respective organization to access the resource.
        '404':
          description: Invalid URL.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The URL you've sent is wrong. It's possible that the resource you've requested has been moved to another URL.
        '405':
          description: Method Not Allowed.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The requested resource does not support the HTTP method used. For example, requesting List of all customers API with PUT as the HTTP method.
        '406':
          description: Not Acceptable.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The response has been received but the requested response type is not supported by the browser.
        '429':
          description: Too many requests.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Too many requests within a certain time frame.
        '500':
          description: Internal Server Error.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Cliq server encountered an error which prevents it from fulfilling the request.
      security:
        - Cliq_Auth:
            - ZohoCliq.Webhooks.CREATE
      tags:
        - messages
  /channels/{CHANNEL_ID}/message:
    post:
      summary: Post message in a channel with CHANNEL_ID
      operationId: Post message in a channel with CHANNEL_ID
      description: |
        <p>
          Use this API to post a message in a channel by giving the channel ID in the request URL, followed by the message object containing plain text or message card.<br><br>
          You can also send a message in a Cliq channel using the following alternative endpoint:<br>
          <a href="/messages/#post-message-in-a-channel-with-channel-unique-name"><code>POST /channelsbyname/{CHANNEL_UNIQUE_NAME}/message</code></a> - Use this endpoint to post a message in a channel using its unique name.<br><br>
          Furthermore, you can specify the <code>bot_unique_name</code> query parameter in either of the above endpoints to post a message as a bot in the channel.<br><br>
          <b>Threshold limit</b>: 50 requests per min per user<br>
          Number of API calls allowed within a minute.<br>
          This limit is per user, not per token — even if messages are sent using multiple OAuth tokens by the same user, all requests count toward this shared limit.<br><br>
          <b>Lock period</b>: 10 minutes<br>Wait time before consecutive API requests.<br>
        </p>
      parameters:
        - name: CHANNEL_ID
          in: path
          description: ID of the channel. To learn how to retrieve this ID, see <a href="/cliq/help/restapi/v2/glossary/#CHANNEL_ID">CHANNEL_ID</a> in the Glossary page.
          required: true
          schema:
            type: string
          example: CHANNEL_ID
        - name: bot_unique_name
          in: query
          description: Use this parameter to send a message in a channel as a bot. Note that the bot should already be a participant in the channel.
          required: false
          schema:
            type: string
        - name: mark_as_read
          in: query
          description: Use these APIs to mark the sent message as read for the user. By default, the message will be unread for the message posted by the user.
          required: false
          schema:
            type: boolean
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/post-message-in-a-channel-request'
      responses:
        '200':
          description: The request was successfully completed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/post-message-in-a-channel-response'
        '400':
          description: Bad Request.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The request cannot be performed. Usually because of malformed parameter or missing parameter.
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Request was rejected because of invalid AuthToken.
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The user does not have enough permission or possibly not an user of the respective organization to access the resource.
        '404':
          description: Invalid URL.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The URL you've sent is wrong. It's possible that the resource you've requested has been moved to another URL.
        '405':
          description: Method Not Allowed.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The requested resource does not support the HTTP method used. For example, requesting List of all customers API with PUT as the HTTP method.
        '406':
          description: Not Acceptable.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The response has been received but the requested response type is not supported by the browser.
        '429':
          description: Too many requests.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Too many requests within a certain time frame.
        '500':
          description: Internal Server Error.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Cliq server encountered an error which prevents it from fulfilling the request.
      security:
        - Cliq_Auth:
            - ZohoCliq.Webhooks.CREATE
      tags:
        - messages
  /channelsbyname/{CHANNEL_UNIQUE_NAME}/message?bot_unique_name={BOT_UNIQUE_NAME}:
    post:
      summary: Post message to a channel as bot
      operationId: postToChannelAsBot
      description: |
        <p>
          Use this API to post a message as a bot in a Cliq channel.
          You can also use the following alternative endpoint to post a message as a bot in a channel:<br><br>
          <a href="/messages/#post-message-in-a-channel-with-channel-id"><code>POST /channels/{CHANNEL_ID}/message?bot_unique_name={BOT_UNIQUE_NAME}</code></a> - Use this endpoint to post a message as a bot in a channel using its channel ID.<br><br>
          <b>Deluge task to post a message as bot in a channel</b>:<br>
          <a href="https://www.zoho.com/deluge/help/cliq/post-to-channel.html" target="_blank"><code>zoho.cliq.postToChannelAsBot({CHANNEL_UNIQUE_NAME},{BOT_UNIQUE_NAME},message);</code></a><br><br>
        <b>Note:</b> 
        <ul>
         <li>Please note that the bot must be added to the channel for this task to function properly. To use this task, you should meet at least one of the following criteria:</li>
         <ol>
          <li>Be a participant in the channel.</li>
          <li>Be the bot owner.</li>
          <li>Be an organization admin.</li>
         </ol>
         <li>Additionally, the postToChannelAsBot task in Deluge is not supported when triggered from Zoho Creator.</li>
        </ul>
        <p>
          <b>Threshold limit</b>: 50 requests per min per user<br>
          Number of API calls allowed within a minute.<br>
          This limit is per user, not per token — even if messages are sent using multiple OAuth tokens by the same user, all requests count toward this shared limit.<br><br>
          <b>Lock period</b>: 10 minutes<br>Wait time before consecutive API requests.<br>
        </p>
      parameters:
        - name: CHANNEL_UNIQUE_NAME1
          in: path
          description: |
            Unique name of the channel. To learn how to retrieve this ID, see <a href="/cliq/help/restapi/v2/glossary/#CHANNEL_UNIQUE_NAME">CHANNEL_UNIQUE_NAME</a> in the Glossary page.<br><br>
            <b>Note:</b> <code>CHANNEL_UNIQUE_NAME1</code> is a documentation alias for <code>CHANNEL_UNIQUE_NAME</code>, used to document the "Post message to a channel as bot" use case separately while sharing the same <code>/channelsbyname/{CHANNEL_UNIQUE_NAME}/message</code> endpoint.
          required: true
          schema:
            type: string
          example: CHANNEL_UNIQUE_NAME
        - name: bot_unique_name
          in: query
          description: Unique name of the bot that should post the message in the channel. The bot must already be a participant in the channel.
          required: true
          schema:
            type: string
            example: zylkersupport
        - name: mark_as_read
          in: query
          description: Use these APIs to mark the sent message as read for the user. By default, the message will be unread for the message posted by the user.
          required: false
          schema:
            type: boolean
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/post-message-in-a-channel-request'
            examples:
              post-to-channel-as-bot:
                summary: Post business update to channel as bot
                value:
                  text: 'Support update: The payment incident has been resolved. Please retry failed transactions and report any anomalies in this thread.'
                  sync_message: true
      responses:
        '200':
          description: The request was successfully completed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/post-message-in-a-channel-response'
        '400':
          description: Bad Request.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The request cannot be performed. Usually because of malformed parameter or missing parameter.
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Request was rejected because of invalid AuthToken.
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The user does not have enough permission or possibly not an user of the respective organization to access the resource.
        '404':
          description: Invalid URL.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The URL you've sent is wrong. It's possible that the resource you've requested has been moved to another URL.
        '405':
          description: Method Not Allowed.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The requested resource does not support the HTTP method used. For example, requesting List of all customers API with PUT as the HTTP method.
        '406':
          description: Not Acceptable.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The response has been received but the requested response type is not supported by the browser.
        '429':
          description: Too many requests.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Too many requests within a certain time frame.
        '500':
          description: Internal Server Error.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Cliq server encountered an error which prevents it from fulfilling the request.
      security:
        - Cliq_Auth:
            - ZohoCliq.Webhooks.CREATE
      tags:
        - messages
  /bots/{BOT_UNIQUE_NAME}/message:
    post:
      summary: Post message to a bot
      operationId: Post message to a bot
      description: |
        Send a message to a bot using its unique name.
        <br><br>
        <p>
          <b>Threshold limit</b>: 20 requests per min per user<br>
          Number of API calls allowed within a minute.<br><br>
          <b>Lock period</b>: 10 minutes<br>Wait time before consecutive API requests.<br>
        </p>
      parameters:
        - name: BOT_UNIQUE_NAME
          in: path
          description: Use this parameter to send a message in a channel as a bot. Note that the bot should already be a participant in the channel. To learn how to retrieve this ID, see <a href="/cliq/help/restapi/v2/glossary/#BOT_UNIQUE_NAME">BOT_UNIQUE_NAME</a> in the Glossary page.
          required: true
          schema:
            type: string
          example: BOT_UNIQUE_NAME
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/post-message-to-a-bot-request'
            examples:
              post-message-to-bot-with-zuids:
                summary: Post message to a bot with ZUIDs in userids
                value:
                  text: 'Reminder: Q2 revenue review starts at 3:00 PM IST. Please upload your final forecast sheet before 2:30 PM.'
                  userids: 55743307,55622727
                  sync_message: true
              post-message-to-bot-with-emailids:
                summary: Post message to a bot with email IDs in userids
                value:
                  text: 'Action required: Please approve the marketing budget proposal by EOD so we can proceed with the vendor onboarding.'
                  userids: scott.fisher@zylker.com,li.jung@zylker.com
                  sync_message: true
      responses:
        '200':
          description: The request was successfully completed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/post-message-to-a-bot-response'
        '400':
          description: Bad Request.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The request cannot be performed. Usually because of malformed parameter or missing parameter.
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Request was rejected because of invalid AuthToken.
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The user does not have enough permission or possibly not an user of the respective organization to access the resource.
        '404':
          description: Invalid URL.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The URL you've sent is wrong. It's possible that the resource you've requested has been moved to another URL.
        '405':
          description: Method Not Allowed.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The requested resource does not support the HTTP method used. For example, requesting List of all customers API with PUT as the HTTP method.
        '406':
          description: Not Acceptable.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The response has been received but the requested response type is not supported by the browser.
        '429':
          description: Too many requests.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Too many requests within a certain time frame.
        '500':
          description: Internal Server Error.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Cliq server encountered an error which prevents it from fulfilling the request.
      security:
        - Cliq_Auth:
            - ZohoCliq.Webhooks.CREATE
      tags:
        - messages
  /chats/{CHAT_ID}/message:
    post:
      summary: Post message in chat
      operationId: Post message in chat
      description: |
        To post message in a chat (or thread), the chat_id (thread_id in case of threads) can be used in the request URL.
        <br><br>
        <p>
          <b>Threshold limit</b>: 50 requests per min per user<br>
          Number of API calls allowed within a minute.<br>
          This limit is per user, not per token — even if messages are sent using multiple OAuth tokens by the same user, all requests count toward this shared limit.<br><br>
          <b>Lock period</b>: 10 minutes<br>Wait time before consecutive API requests.<br>
        </p>  
      parameters:
        - name: CHAT_ID
          in: path
          required: true
          schema:
            type: string
          example: CHAT_ID
          description: The ID of the chat where the message should be posted To learn how to retrieve this ID, see <a href="/cliq/help/restapi/v2/glossary/#CHAT_ID">CHAT_ID</a> in the Glossary page.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/post-message-in-chat-request'
      responses:
        '200':
          description: The request was successfully completed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/post-message-in-a-chat-response'
        '400':
          description: Bad Request.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The request cannot be performed. Usually because of malformed parameter or missing parameter.
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Request was rejected because of invalid AuthToken.
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The user does not have enough permission or possibly not an user of the respective organization to access the resource.
        '404':
          description: Invalid URL.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The URL you've sent is wrong. It's possible that the resource you've requested has been moved to another URL.
        '405':
          description: Method Not Allowed.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The requested resource does not support the HTTP method used. For example, requesting List of all customers API with PUT as the HTTP method.
        '406':
          description: Not Acceptable.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The response has been received but the requested response type is not supported by the browser.
        '429':
          description: Too many requests.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Too many requests within a certain time frame.
        '500':
          description: Internal Server Error.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Cliq server encountered an error which prevents it from fulfilling the request.
      security:
        - Cliq_Auth:
            - ZohoCliq.Webhooks.CREATE
      tags:
        - messages
  /buddies/{EMAIL_ID}/message:
    post:
      summary: Post message to a user with EMAIL_ID
      operationId: Post message to a user with EMAIL_ID
      description: |
        Post a message to a user by giving the email ID in the request URL, followed by the message object containing plain text or message card.
        <br>
        You can also use <code>/buddies/{ZUID}/message</code> to post a message using the user's ZUID.
        <br><br>
        <b>Note:</b> This API will be not applicable if the intended user is neither a mutual contact nor your organization member. 
        <br><br>
        <p>
          <b>Threshold limit</b>: 20 requests per min per user<br>
          Number of API calls allowed within a minute.<br><br>
          <b>Lock period</b>: 10 minutes<br>Wait time before consecutive API requests.<br>
        </p>
              
      parameters:
        - name: EMAIL_ID
          in: path
          required: true
          schema:
            type: string
          example: EMAIL_ID
          description: The email ID of the user to whom the message should be sent. To learn how to retrieve this ID, see <a href="/cliq/help/restapi/v2/glossary/#EMAIL_ID">EMAIL_ID</a> in the Glossary page.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/post-message-in-chat-request'
      responses:
        '200':
          description: The request was successfully completed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/post-message-in-a-chat-response'
        '400':
          description: Bad Request.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The request cannot be performed. Usually because of malformed parameter or missing parameter.
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Request was rejected because of invalid AuthToken.
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The user does not have enough permission or possibly not an user of the respective organization to access the resource.
        '404':
          description: Invalid URL.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The URL you've sent is wrong. It's possible that the resource you've requested has been moved to another URL.
        '405':
          description: Method Not Allowed.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The requested resource does not support the HTTP method used. For example, requesting List of all customers API with PUT as the HTTP method.
        '406':
          description: Not Acceptable.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The response has been received but the requested response type is not supported by the browser.
        '429':
          description: Too many requests.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Too many requests within a certain time frame.
        '500':
          description: Internal Server Error.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Cliq server encountered an error which prevents it from fulfilling the request.
      security:
        - Cliq_Auth:
            - ZohoCliq.Webhooks.CREATE
      tags:
        - messages
  /buddies/{ZUID}/message:
    post:
      summary: Post message to a user with ZUID
      operationId: Post message to a user with ZUID
      description: |
        Post a message to a user by giving the user's ZUID in the request URL, followed by the message object containing plain text or message card.
        <br>
        You can also use <code>/buddies/{EMAIL_ID}/message</code> to post a message using the user's email ID.
        <br><br>
        <b>Note:</b> This API will be not applicable if the intended user is neither a mutual contact nor your organization member.
        <br><br>
        <p>
          <b>Threshold limit</b>: 20 requests per min per user<br>
          Number of API calls allowed within a minute.<br><br>
          <b>Lock period</b>: 10 minutes<br>Wait time before consecutive API requests.<br>
        </p>
      parameters:
        - name: ZUID
          in: path
          required: true
          schema:
            type: string
          example: ZUID
          description: The ZUID of the user to whom the message should be sent. To learn how to retrieve this ID, see <a href="/cliq/help/restapi/v2/glossary/#ZUID">ZUID</a> in the Glossary page.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/post-message-in-chat-request'
      responses:
        '200':
          description: The request was successfully completed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/post-message-in-a-chat-response'
        '400':
          description: Bad Request.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The request cannot be performed. Usually because of malformed parameter or missing parameter.
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Request was rejected because of invalid AuthToken.
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The user does not have enough permission or possibly not an user of the respective organization to access the resource.
        '404':
          description: Invalid URL.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The URL you've sent is wrong. It's possible that the resource you've requested has been moved to another URL.
        '405':
          description: Method Not Allowed.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The requested resource does not support the HTTP method used. For example, requesting List of all customers API with PUT as the HTTP method.
        '406':
          description: Not Acceptable.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The response has been received but the requested response type is not supported by the browser.
        '429':
          description: Too many requests.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Too many requests within a certain time frame.
        '500':
          description: Internal Server Error.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Cliq server encountered an error which prevents it from fulfilling the request.
      security:
        - Cliq_Auth:
            - ZohoCliq.Webhooks.CREATE
      tags:
        - messages
  /chats/{CHAT_ID}/messages/{MESSAGE_ID}:
    get:
      summary: Retrieve a message
      operationId: Retrieve a message
      description: |
        Use this API to retrieve a message from a chat conversation that you have access to. Get the message's unique ID by calling the get messages API.
         <br><br>
         <p> 
           <b>Threshold limit</b>: 30 requests per min per user<br>
           Number of API calls allowed within a minute.<br><br>
           <b>Lock period</b>: 10 minutes<br>Wait time before consecutive API requests.<br>  
         </p>  
      parameters:
        - name: CHAT_ID
          in: path
          required: true
          schema:
            type: string
          example: CHAT_ID
          description: The ID of the chat from which messages are retrieved To learn how to retrieve this ID, see <a href="/cliq/help/restapi/v2/glossary/#CHAT_ID">CHAT_ID</a> in the Glossary page.
        - name: MESSAGE_ID
          in: path
          required: true
          schema:
            type: string
          example: MESSAGE_ID
          description: The ID of the message to be retrieved To learn how to retrieve this ID, see <a href="/cliq/help/restapi/v2/glossary/#MESSAGE_ID">MESSAGE_ID</a> in the Glossary page.
      responses:
        '200':
          description: The request was successfully completed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/message_data'
        '400':
          description: Bad Request.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The request cannot be performed. Usually because of malformed parameter or missing parameter.
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Request was rejected because of invalid AuthToken.
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The user does not have enough permission or possibly not an user of the respective organization to access the resource.
        '404':
          description: Invalid URL.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The URL you've sent is wrong. It's possible that the resource you've requested has been moved to another URL.
        '405':
          description: Method Not Allowed.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The requested resource does not support the HTTP method used. For example, requesting List of all customers API with PUT as the HTTP method.
        '406':
          description: Not Acceptable.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The response has been received but the requested response type is not supported by the browser.
        '429':
          description: Too many requests.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Too many requests within a certain time frame.
        '500':
          description: Internal Server Error.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Cliq server encountered an error which prevents it from fulfilling the request.
      security:
        - Cliq_Auth:
            - ZohoCliq.Messages.READ
      tags:
        - messages
    put:
      summary: Edit a message
      operationId: Edit a message
      description: |
        Use this API to edit a message in a conversation. Get the message's unique ID by using the get messages API.
        <br><br>
        <p> 
          <b>Threshold limit</b>: 20 requests per min per user<br>
          Number of API calls allowed within a minute.<br><br>
          <b>Lock period</b>: 10 minutes<br>Wait time before consecutive API requests.<br>
        </p>  
      parameters:
        - name: CHAT_ID
          in: path
          required: true
          schema:
            type: string
          example: CHAT_ID
          description: The ID of the chat where the message should be edited To learn how to retrieve this ID, see <a href="/cliq/help/restapi/v2/glossary/#CHAT_ID">CHAT_ID</a> in the Glossary page.
        - name: MESSAGE_ID
          in: path
          required: true
          schema:
            type: string
          example: MESSAGE_ID
          description: The ID of the message which needs to be edited To learn how to retrieve this ID, see <a href="/cliq/help/restapi/v2/glossary/#MESSAGE_ID">MESSAGE_ID</a> in the Glossary page.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/edit-a-message-request'
      responses:
        '200':
          description: The request was successfully completed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/post-message-in-a-channel-response'
        '400':
          description: Bad Request.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The request cannot be performed. Usually because of malformed parameter or missing parameter.
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Request was rejected because of invalid AuthToken.
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The user does not have enough permission or possibly not an user of the respective organization to access the resource.
        '404':
          description: Invalid URL.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The URL you've sent is wrong. It's possible that the resource you've requested has been moved to another URL.
        '405':
          description: Method Not Allowed.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The requested resource does not support the HTTP method used. For example, requesting List of all customers API with PUT as the HTTP method.
        '406':
          description: Not Acceptable.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The response has been received but the requested response type is not supported by the browser.
        '429':
          description: Too many requests.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Too many requests within a certain time frame.
        '500':
          description: Internal Server Error.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Cliq server encountered an error which prevents it from fulfilling the request.
      security:
        - Cliq_Auth:
            - ZohoCliq.Messages.UPDATE
      tags:
        - messages
    delete:
      summary: Delete a message
      operationId: Delete a message
      description: |
        Use this API to delete a message in a conversation. Get the message's unique ID by using the get messages API.
        <br><br>
        <p> 
          <b>Threshold limit</b>: 20 requests per min per user<br>
          Number of API calls allowed within a minute.<br><br>
          <b>Lock period</b>: 10 minutes<br>Wait time before consecutive API requests.<br>
        </p>
           
      parameters:
        - name: CHAT_ID
          in: path
          required: true
          schema:
            type: string
          example: CHAT_ID
          description: The ID of the chat where the message should be deleted To learn how to retrieve this ID, see <a href="/cliq/help/restapi/v2/glossary/#CHAT_ID">CHAT_ID</a> in the Glossary page.
        - name: MESSAGE_ID
          in: path
          required: true
          schema:
            type: string
          example: MESSAGE_ID
          description: The ID of the message which needs to be deleted To learn how to retrieve this ID, see <a href="/cliq/help/restapi/v2/glossary/#MESSAGE_ID">MESSAGE_ID</a> in the Glossary page.
      responses:
        '200':
          description: The request was successfully completed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/post-message-in-a-channel-response'
        '400':
          description: Bad Request.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The request cannot be performed. Usually because of malformed parameter or missing parameter.
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Request was rejected because of invalid AuthToken.
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The user does not have enough permission or possibly not an user of the respective organization to access the resource.
        '404':
          description: Invalid URL.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The URL you've sent is wrong. It's possible that the resource you've requested has been moved to another URL.
        '405':
          description: Method Not Allowed.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The requested resource does not support the HTTP method used. For example, requesting List of all customers API with PUT as the HTTP method.
        '406':
          description: Not Acceptable.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The response has been received but the requested response type is not supported by the browser.
        '429':
          description: Too many requests.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Too many requests within a certain time frame.
        '500':
          description: Internal Server Error.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Cliq server encountered an error which prevents it from fulfilling the request.
      security:
        - Cliq_Auth:
            - ZohoCliq.Messages.DELETE
      tags:
        - messages
  /chats/{CHAT_ID}/messages/{MESSAGE_ID}/reactions:
    get:
      summary: Get Reactions
      operationId: Get Reactions
      description: |
        Use this API to retrieve details for all reactions to a specific message.
        <br><br>
        <p>
          <b>Threshold limit</b>: 20 requests per min per user<br>
          Number of API calls allowed within a minute.<br><br>
          <b>Lock period</b>: 10 minutes<br>Wait time before consecutive API requests.<br>
        </p> 
      parameters:
        - name: CHAT_ID
          in: path
          required: true
          schema:
            type: string
          example: CHAT_ID
          description: The ID of the chat containing the message To learn how to retrieve this ID, see <a href="/cliq/help/restapi/v2/glossary/#CHAT_ID">CHAT_ID</a> in the Glossary page.
        - name: MESSAGE_ID
          in: path
          required: true
          schema:
            type: string
          example: MESSAGE_ID
          description: The ID of the message for which reactions are to be fetched To learn how to retrieve this ID, see <a href="/cliq/help/restapi/v2/glossary/#MESSAGE_ID">MESSAGE_ID</a> in the Glossary page.
      responses:
        '200':
          description: The request was successfully completed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/get-reactions'
        '400':
          description: Bad Request.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The request cannot be performed. Usually because of malformed parameter or missing parameter.
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Request was rejected because of invalid AuthToken.
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The user does not have enough permission or possibly not an user of the respective organization to access the resource.
        '404':
          description: Invalid URL.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The URL you've sent is wrong. It's possible that the resource you've requested has been moved to another URL.
        '405':
          description: Method Not Allowed.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The requested resource does not support the HTTP method used. For example, requesting List of all customers API with PUT as the HTTP method.
        '406':
          description: Not Acceptable.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The response has been received but the requested response type is not supported by the browser.
        '429':
          description: Too many requests.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Too many requests within a certain time frame.
        '500':
          description: Internal Server Error.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Cliq server encountered an error which prevents it from fulfilling the request.
      security:
        - Cliq_Auth:
            - ZohoCliq.messageactions.READ
      tags:
        - messages
    post:
      summary: Add a reaction
      operationId: Add a reaction
      description: |
        Use this API to add a react to a message sent in a chat. Get the message's unique ID by using the get messages API.
        <br><br>
        <p>
          <b>Threshold limit</b>: 20 requests per min per user<br>
          Number of API calls allowed within a minute.<br><br>
          <b>Lock period</b>: 10 minutes<br>Wait time before consecutive API requests.<br>
        </p>
      parameters:
        - name: CHAT_ID
          in: path
          required: true
          schema:
            type: string
          example: CHAT_ID
          description: The ID of the chat containing the message To learn how to retrieve this ID, see <a href="/cliq/help/restapi/v2/glossary/#CHAT_ID">CHAT_ID</a> in the Glossary page.
        - name: MESSAGE_ID
          in: path
          required: true
          schema:
            type: string
          example: MESSAGE_ID
          description: The ID of the message for which reaction need to be added To learn how to retrieve this ID, see <a href="/cliq/help/restapi/v2/glossary/#MESSAGE_ID">MESSAGE_ID</a> in the Glossary page.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/add-a-reaction-request'
      responses:
        '200':
          description: The request was successfully completed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/post-message-in-a-channel-response'
        '400':
          description: Bad Request.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The request cannot be performed. Usually because of malformed parameter or missing parameter.
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Request was rejected because of invalid AuthToken.
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The user does not have enough permission or possibly not an user of the respective organization to access the resource.
        '404':
          description: Invalid URL.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The URL you've sent is wrong. It's possible that the resource you've requested has been moved to another URL.
        '405':
          description: Method Not Allowed.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The requested resource does not support the HTTP method used. For example, requesting List of all customers API with PUT as the HTTP method.
        '406':
          description: Not Acceptable.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The response has been received but the requested response type is not supported by the browser.
        '429':
          description: Too many requests.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Too many requests within a certain time frame.
        '500':
          description: Internal Server Error.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Cliq server encountered an error which prevents it from fulfilling the request.
      security:
        - Cliq_Auth:
            - ZohoCliq.messageactions.CREATE
      tags:
        - messages
    delete:
      summary: Delete a reaction
      operationId: Delete a reaction
      description: |
        Use this API to delete the reaction to a message.
        <br><br>
        <p>
          <b>Threshold limit</b>: 20 requests per min per user<br>
          Number of API calls allowed within a minute.<br><br>
          <b>Lock period</b>: 10 minutes<br>Wait time before consecutive API requests.<br>
        </p>  
      parameters:
        - name: CHAT_ID
          in: path
          required: true
          schema:
            type: string
          example: CHAT_ID
          description: The ID of the chat containing the message To learn how to retrieve this ID, see <a href="/cliq/help/restapi/v2/glossary/#CHAT_ID">CHAT_ID</a> in the Glossary page.
        - name: MESSAGE_ID
          in: path
          required: true
          schema:
            type: string
          example: MESSAGE_ID
          description: The ID of the message for which reaction need to be added To learn how to retrieve this ID, see <a href="/cliq/help/restapi/v2/glossary/#MESSAGE_ID">MESSAGE_ID</a> in the Glossary page.
        - name: emoji_code
          in: query
          schema:
            type: string
          description: 'Use this parameter to add a reaction to a message sent in a chat.Allowed values: Zomojis | Unicode smiley.'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/add-a-reaction-request'
      responses:
        '200':
          description: The request was successfully completed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/post-message-in-a-channel-response'
        '400':
          description: Bad Request.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The request cannot be performed. Usually because of malformed parameter or missing parameter.
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Request was rejected because of invalid AuthToken.
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The user does not have enough permission or possibly not an user of the respective organization to access the resource.
        '404':
          description: Invalid URL.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The URL you've sent is wrong. It's possible that the resource you've requested has been moved to another URL.
        '405':
          description: Method Not Allowed.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The requested resource does not support the HTTP method used. For example, requesting List of all customers API with PUT as the HTTP method.
        '406':
          description: Not Acceptable.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The response has been received but the requested response type is not supported by the browser.
        '429':
          description: Too many requests.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Too many requests within a certain time frame.
        '500':
          description: Internal Server Error.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Cliq server encountered an error which prevents it from fulfilling the request.
      security:
        - Cliq_Auth:
            - ZohoCliq.messageactions.CREATE
      tags:
        - messages
components:
  schemas:
    MessageRequest:
      type: object
      description: Request object to send messages to one or more users.
      required:
        - user_ids
        - message_details
      properties:
        user_ids:
          type: array
          description: List of user IDs to whom the message will be sent.
          items:
            type: string
            description: A single user's ID.
          example:
            - '55743307'
            - '55622727'
        message_details:
          type: object
          description: Message details mapped per user ID.
          additionalProperties:
            type: object
            description: Details for a specific user message.
            required:
              - chat_id
              - message_id
            properties:
              chat_id:
                type: string
                description: Chat identifier where the message will be sent.
                example: CT_1203304812000146098_55622663-B2
              message_id:
                type: string
                description: Unique message identifier in the chat.
                example: 1709038327622%2029706114886
    UserMessage:
      type: object
      description: Represents message details for multiple users.
      properties:
        user_ids:
          type: array
          description: List of user IDs.
          items:
            type: string
            description: Single user ID.
          example:
            - '55743307'
            - '55622727'
        message_details:
          type: object
          description: Mapping of each user ID to message details.
          additionalProperties:
            type: object
            description: Individual user message details.
            properties:
              chat_id:
                type: string
                description: Chat identifier.
                example: CT_1203304812000146098_55622663-B2
              message_id:
                type: string
                description: Message ID for the chat.
                example: 1709038327622%2029706114886
    MessageComponents:
      type: object
      description: Core components of a message.
      properties:
        id:
          type: string
          description: Unique identifier for the message.
          example: '1542711601585_349430767610289'
        fileMessage_id:
          type: string
          description: Identifier for a file message, if applicable.
          example: '1543384891842_351840917549285'
        time:
          type: integer
          description: Epoch timestamp of when the message was sent.
          example: 1542798001273
        type:
          type: string
          description: Type of the message, e.g., 'text', 'file'.
          example: text
    file_type:
      type: string
      description: Format/type of an attachment message.
      example: file
    senderName:
      type: string
      description: Name of the message sender.
      example: Scott Fisher
    senderID:
      type: string
      description: User ID of the message sender.
      example: '1542798001273'
    sender:
      type: object
      description: Information about the sender of the message.
      properties:
        senderName:
          $ref: '#/components/schemas/senderName'
        senderID:
          $ref: '#/components/schemas/senderID'
    messageText:
      type: string
      description: Text content of the message.
      example: Hi! What time is the review meeting today?
    content:
      type: object
      description: Content object containing text message.
      properties:
        messageText:
          $ref: '#/components/schemas/messageText'
    fileName:
      type: string
      description: Original filename of the attachment.
      example: Feature-overview.jpg
    contentType:
      type: string
      description: MIME type of the attachment.
      example: image/jpeg
    imageHeight:
      type: integer
      description: Height of the image in pixels.
      example: 3510
    imageSize:
      type: integer
      description: Size of the image file in bytes.
      example: 559008
    imageWidth:
      type: integer
      description: Width of the image in pixels.
      example: 2552
    dimensions:
      type: object
      description: Dimensions and size of a file or image.
      properties:
        height:
          $ref: '#/components/schemas/imageHeight'
        width:
          $ref: '#/components/schemas/imageWidth'
        size:
          $ref: '#/components/schemas/imageSize'
    file_id:
      type: string
      description: Unique identifier for the file.
      example: f3791c2279a67f6e5cbc8e1beb41ded85da2bdc672e2496ba9af50c0c24c8e2e453862a8a28becb86f859ab142d44633b05a8fb2ff34955c9e9824527c15cd03
    file_content:
      type: object
      description: File metadata and content reference.
      properties:
        name:
          $ref: '#/components/schemas/fileName'
        type:
          $ref: '#/components/schemas/file_type'
        dimensions:
          $ref: '#/components/schemas/dimensions'
        id:
          $ref: '#/components/schemas/file_id'
    thumbnailHeight:
      type: integer
      description: Height of the thumbnail image.
      example: 230
    thumbnailWidth:
      type: integer
      description: Width of the thumbnail image.
      example: 400
    blur_data:
      type: string
      description: Base64 encoded placeholder for image blur effect.
      example: /9j/4AAQSkZJRgABAgAAAQABAAD/2wBD...
    thumbnail:
      type: object
      description: Thumbnail representation of an image or file.
      properties:
        height:
          $ref: '#/components/schemas/thumbnailHeight'
        width:
          $ref: '#/components/schemas/thumbnailWidth'
        blur_data:
          $ref: '#/components/schemas/blur_data'
    comment:
      type: string
      description: Message sent along with a file.
      example: Hey Emily! Hope you understand the above design
    fileMessage_content:
      type: object
      description: Content structure for a file message.
      properties:
        thumbnail:
          $ref: '#/components/schemas/thumbnail'
        file:
          $ref: '#/components/schemas/file_content'
        comment:
          $ref: '#/components/schemas/comment'
    message_data:
      type: object
      description: Standard text message data structure.
      properties:
        sender:
          $ref: '#/components/schemas/sender'
        id:
          type: string
          description: Message ID.
          example: '1542711601585_349430767610289'
        time:
          type: integer
          description: Timestamp of the message.
          example: 1542798001273
        type:
          type: string
          description: Type of message.
          example: text
        content:
          type: string
          description: Text content of the message.
          example: Hello world
    fileMessage_data:
      type: object
      description: Structure for file messages.
      properties:
        sender:
          type: object
          description: Sender information for the file message.
          properties:
            name:
              type: string
              description: Name of the sender.
              example: John Doe
            id:
              type: string
              description: ID of the sender.
              example: '55743307'
        id:
          type: string
          description: Message ID.
          example: '1542711601585_349430767610289'
        time:
          type: integer
          description: Epoch timestamp of the message.
          example: 1542798001273
        type:
          $ref: '#/components/schemas/file_type'
        content:
          $ref: '#/components/schemas/fileMessage_content'
    get-messages-response:
      type: object
      description: Response object for fetching messages.
      properties:
        data:
          type: array
          description: Array containing message objects.
          minItems: 2
          maxItems: 2
          items:
            oneOf:
              - $ref: '#/components/schemas/fileMessage_data'
              - $ref: '#/components/schemas/message_data'
    post-message-in-a-chat-response:
      type: object
      description: Response object for posting messages in a chat/user
      properties:
        message_id:
          type: string
          description: Unique identifier of the newly posted message
          example: '1599387839188_229293271789'
    post-message-in-a-channel-request:
      type: object
      description: Request object to post a message in a channel.
      required:
        - text
      properties:
        text:
          type: string
          description: |
            Message text to be sent in the channel.<br>
            <b>Maximum length:</b> 5000.
          maxLength: 5000
          example: Hello team, please review the project status update and share your feedback by EOD.
        reply_to:
          type: string
          description: |
            Use this parameter to reply to a message shared in a channel.
            To learn how to retrieve message IDs, see <a href="/cliq/help/restapi/v2/glossary/#MESSAGE_ID">MESSAGE_ID</a> in the Glossary page.
          example: '72374289911'
        sync_message:
          type: boolean
          description: |
            <ul>
              <li>Use this parameter to post a message in a synchronous thread.</li>
              <li>If sync_message = true, the MESSAGE_ID will be returned as the response.</li>
              <li>Note that the MESSAGE_ID will not be returned if the message is posted as a bot.</li>
            </ul>
          example: true
    post-message-in-a-channel-response:
      type: object
      description: Response object after posting a message in a channel.
      properties:
        Response Code:
          type: string
          description: HTTP response code for the operation.
          example: 204 No response
    post-message-to-a-bot-request:
      type: object
      description: Request object to send a message to a bot.
      required:
        - text
      properties:
        text:
          type: string
          description: 'Message text to send to the bot. Maximum length: 5000.'
          maxLength: 5000
          example: Hey!
        userids:
          type: string
          description: Comma-separated user identifiers to broadcast the message to bot subscribers. You can pass either ZUIDs or email IDs.
          example: 55743307,55622727
        sync_message:
          type: boolean
          description: Post message in synchronous thread; returns chat_id and message_id.
          example: true
        reply_to:
          type: string
          description: Reply to a message in the bot conversation.
          example: '723489201'
    post-message-to-a-bot-response:
      type: object
      description: Response object after sending a message to a bot.
      properties:
        user_ids:
          type: array
          description: List of user IDs who received the message.
          items:
            type: string
            description: User ID.
        message_details:
          type: object
          description: Mapping of user IDs to their chat and message details.
          additionalProperties:
            type: object
            description: Details of message per user.
            properties:
              chat_id:
                type: string
                description: Chat ID for the user.
              message_id:
                type: string
                description: Message ID for the user.
      example:
        user_ids:
          - '55743307'
          - '55622727'
        message_details:
          '55622727':
            chat_id: CT_1203304812000146098_55622663-B2
            message_id: 1709038327622%2029706114886
          '55743307':
            chat_id: CT_1203304811888980596_55622663-B2
            message_id: 1709038327612%20712605914940
    post-message-in-chat-request:
      type: object
      description: Request object to send a message in a chat.
      required:
        - text
      properties:
        text:
          type: string
          description: 'Text content to send in chat. Maximum length: 5000.'
          maxLength: 5000
          example: Hey!
        reply_to:
          type: string
          description: Message ID to reply to in chat.
          example: '55743307'
        sync_message:
          type: boolean
          description: Post message in synchronous thread; returns message ID.
          example: true
        mark_as_read:
          type: boolean
          description: Mark the message as read for the user.
          example: true
    post-message-in-chat-response:
      type: object
      description: Response object after posting a message in chat.
      properties:
        message_id:
          type: string
          description: Message ID returned after posting.
          example: '1599387839188_229293271789'
    edit-a-message-request:
      type: object
      description: Request object to edit an existing message.
      required:
        - text
      properties:
        text:
          type: string
          description: 'Edited text content of the message. Maximum length: 5000.'
          maxLength: 5000
          example: Hey! Cliq platform allows you to manage your workday tasks effectively.
        notify_edit:
          type: boolean
          description: Notify participants about the edited message.
          example: true
    get-reactions:
      type: object
      description: Retrieve all reactions for messages.
      properties:
        data:
          type: object
          description: Mapping of emoji to a list of reaction details.
          additionalProperties:
            type: array
            description: Array of reactions for the emoji.
            items:
              type: string
              description: Reaction string formatted as timestamp:user_id:username.
              pattern: ^\d+:\d+:.+$
          example:
            😍:
              - 1710152648241:802515329:Diana
              - 1710152690025:784333365:Celeste Liane
              - 1710152842875:839672527:Berk Trinity
            🔥:
              - 1710152758419:788604182:Elizebet Tater
              - 1710152797740:19924487:Derek
              - 1710161571235:822083117:Mary E
              - 1710165907573:800612880:Dipika
            💪:
              - 1710152692044:788608119:Velasco
              - 1710152722572:756417177:Guru
              - 1710152861184:785341087:Sanjna
              - 1710155915492:1248183:Catherine
              - 1710165906976:800612880:Elizebet Tater
    add-a-reaction-request:
      type: object
      description: Request object to add a reaction to a message.
      properties:
        emoji_code:
          type: string
          description: |
            Emoji to add to a message.
            Allowed values:

              Zomojis: Custom emojis supported by Zoho Cliq
              Unicode smiley: Standard emojis (for example, U+1F600 or U+2764) passed as actual characters or Unicode.
          example: ':smile:'
    forward-messages-request:
      type: object
      description: Request object to forward one or more messages from a source chat to other chats or users.
      required:
        - source
        - recipients
      properties:
        source:
          type: object
          description: Source chat and messages to forward.
          required:
            - chat_id
            - message_ids
          properties:
            chat_id:
              type: string
              description: Chat ID from which messages are forwarded.
              example: C_987654321
            message_ids:
              type: array
              description: Message IDs to forward (1 to 25).
              minItems: 1
              maxItems: 25
              items:
                type: string
              example:
                - '1742000000000001'
                - '1742000000000002'
        recipients:
          type: object
          description: Target recipients for forwarded messages.
          properties:
            chat_ids:
              type: string
              description: Comma-separated chat IDs to forward to (max 100).
              example: C_111111111,C_222222222
            user_ids:
              type: string
              description: Comma-separated user IDs to forward to (max 100).
              example: 60025012345,60025012346
            forward_as_group:
              type: boolean
              description: If true, creates a single group chat for all user recipients.
              example: false
            show_original_sender:
              type: boolean
              description: If true, shows original sender info on forwarded messages.
              example: true
            title:
              type: string
              description: Title for the group chat when forward_as_group is true (max 255 chars).
              maxLength: 255
              example: Group Title 1
    forward-messages-response:
      type: object
      description: Response object after forwarding messages. Uses a partial-success model.
      properties:
        data:
          type: object
          description: Forwarding results data.
          properties:
            source_chat_id:
              type: string
              description: Source chat ID from which messages were forwarded.
              example: C_987654321
            forwarded:
              type: object
              description: Successfully forwarded recipients.
              properties:
                chat_ids:
                  type: array
                  description: List of chat IDs where messages were successfully forwarded.
                  items:
                    type: string
                  example:
                    - C_111111111
                user_ids:
                  type: array
                  description: List of user IDs to whom messages were successfully forwarded.
                  items:
                    type: string
                  example:
                    - '60025012345'
            failures:
              type: array
              description: List of per-recipient failures with specific error details.
              items:
                type: object
                properties:
                  id:
                    type: string
                    description: Chat ID or user ID that failed.
                    example: C_222222222
                  status:
                    type: string
                    description: Status of the forward attempt.
                    example: failed
                  error:
                    type: object
                    description: Error details for the failure.
                    properties:
                      code:
                        type: string
                        description: Error code.
                        example: chat_with_other_org_users_disabled
                      message:
                        type: string
                        description: Error message.
                        example: Chat with other org users is disabled
    delete-multiple-messages-response:
      type: object
      description: Response object after deleting multiple messages.
      properties:
        type:
          type: string
          description: Response type identifier.
          example: message_delete
        data:
          type: array
          description: List of message deletion results.
          items:
            type: object
            properties:
              id:
                type: string
                description: Message ID.
                example: '1742000000000001'
              status:
                type: string
                description: Deletion status (success or failed).
                example: success
              error:
                type: object
                description: Error details (only present if status is failed).
                properties:
                  code:
                    type: string
                    description: Error code.
                    example: message_delete_not_allowed
                  message:
                    type: string
                    description: Error message.
                    example: You do not have permission to delete this message
    search-messages-response:
      type: object
      description: Response object for message search results.
      properties:
        messages:
          type: array
          description: List of messages matching the search criteria.
          items:
            type: object
            properties:
              message_id:
                type: string
                description: Unique message identifier.
                example: '1710934200000'
              time:
                type: string
                format: date-time
                description: Message timestamp in <a href="https://en.wikipedia.org/wiki/ISO_8601">ISO 8601</a> format.
                example: '2025-03-20T14:30:00.000Z'
              sender:
                type: string
                description: Sender's user ID (ZUID).
                example: 711622XXXX
              chat_id:
                type: string
                description: Chat ID where the message was sent.
                example: 6795XXXXXXXXXXXXXX
              chat_title:
                type: string
                description: Title or name of the chat.
                example: General
              type:
                type: string
                description: Message type (text, file, link).
                example: text
              content:
                type: object
                description: Message content details.
                properties:
                  text:
                    type: string
                    description: Text content of the message.
                    example: Please review the updated proposal.
                  file_name:
                    type: string
                    description: Name of the file (for file type messages).
                    example: proposal_v2.pdf
                  file_type:
                    type: string
                    description: MIME type of the file.
                    example: application/pdf
                  file_size:
                    type: integer
                    description: Size of the file in bytes.
                    example: 204800
              channel_type:
                type: string
                description: Channel type (organisation, team, personal, external).
                example: organisation
        next_token:
          type: string
          description: Pagination cursor for fetching the next page of results.
          example: '1710920099000'
        matched_search_value:
          type: string
          description: The search query that was matched.
          example: proposal
  securitySchemes:
    Cliq_Auth:
      type: oauth2
      x-authorization-example: Bearer 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f
      flows:
        implicit:
          authorizationUrl: https://accounts.zoho.com/oauth/v2/auth
          scopes:
            ZohoCliq.Messages.READ: Read Messages
            ZohoCliq.Messages.CREATE: Create and Forward Messages
            ZohoCliq.Messages.UPDATE: Update Messages
            ZohoCliq.Messages.DELETE: Delete Messages
            ZohoCliq.Webhooks.CREATE: Post messages to your conversations directly or by using incoming webhooks
            ZohoCliq.messageactions.READ: Access message actions
            ZohoCliq.messageactions.CREATE: Create message actions
            ZohoCliq.messageactions.DELETE: Delete message actions
