CometChat Webhooks API

Register webhooks and manage event triggers

OpenAPI Specification

cometchat-webhooks-api-openapi.yml Raw ↑
openapi: 3.0.1
info:
  title: CometChat REST Management Auth Tokens Webhooks API
  description: Server-side REST Management API (v3) for CometChat in-app messaging. Manages users, authentication tokens, groups, group members, messages, conversations, reactions, roles, friends, blocked and banned users, and webhooks for a CometChat app. The API is scoped to a single app and region; the host is derived from your App ID and the region your app is provisioned in (us, eu, in). All requests authenticate with a Rest API Key (fullAccess scope) passed in the `apikey` header. Realtime delivery to end users is handled separately by the CometChat client SDKs over a managed WebSocket layer and is not part of this REST surface.
  termsOfService: https://www.cometchat.com/terms-and-conditions
  contact:
    name: CometChat Support
    url: https://www.cometchat.com/contact-sales
  version: '3.0'
servers:
- url: https://{appId}.api-{region}.cometchat.io/v3
  description: Per-app, per-region CometChat REST Management API host
  variables:
    appId:
      default: APP_ID
      description: Your CometChat App ID from the dashboard
    region:
      default: us
      enum:
      - us
      - eu
      - in
      description: The region your CometChat app is provisioned in
security:
- apiKeyAuth: []
tags:
- name: Webhooks
  description: Register webhooks and manage event triggers
paths:
  /webhooks:
    get:
      operationId: listWebhooks
      tags:
      - Webhooks
      summary: List webhooks
      responses:
        '200':
          description: A list of webhooks.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebhookList'
    post:
      operationId: createWebhook
      tags:
      - Webhooks
      summary: Create a webhook
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateWebhookRequest'
      responses:
        '200':
          description: The created webhook.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebhookResponse'
  /webhooks/{webhookId}:
    parameters:
    - name: webhookId
      in: path
      required: true
      schema:
        type: string
    get:
      operationId: getWebhook
      tags:
      - Webhooks
      summary: Get a webhook
      responses:
        '200':
          description: The requested webhook.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebhookResponse'
    put:
      operationId: updateWebhook
      tags:
      - Webhooks
      summary: Update a webhook
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateWebhookRequest'
      responses:
        '200':
          description: The updated webhook.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebhookResponse'
    delete:
      operationId: deleteWebhook
      tags:
      - Webhooks
      summary: Delete a webhook
      responses:
        '200':
          description: Acknowledgement.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Acknowledgement'
  /webhooks/{webhookId}/triggers:
    parameters:
    - name: webhookId
      in: path
      required: true
      schema:
        type: string
    get:
      operationId: listTriggers
      tags:
      - Webhooks
      summary: List triggers for a webhook
      responses:
        '200':
          description: A list of triggers.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      type: string
    post:
      operationId: addTriggers
      tags:
      - Webhooks
      summary: Add triggers to a webhook
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TriggersRequest'
      responses:
        '200':
          description: Acknowledgement.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Acknowledgement'
    delete:
      operationId: removeTriggers
      tags:
      - Webhooks
      summary: Remove triggers from a webhook
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TriggersRequest'
      responses:
        '200':
          description: Acknowledgement.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Acknowledgement'
components:
  schemas:
    WebhookList:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/Webhook'
    TriggersRequest:
      type: object
      required:
      - triggers
      properties:
        triggers:
          type: array
          items:
            type: string
    Webhook:
      type: object
      properties:
        id:
          type: string
        url:
          type: string
          format: uri
        method:
          type: string
          enum:
          - POST
          - GET
        triggers:
          type: array
          items:
            type: string
        authentication:
          type: object
          properties:
            type:
              type: string
              enum:
              - basic
              - none
            username:
              type: string
            password:
              type: string
        status:
          type: string
          enum:
          - active
          - inactive
    Acknowledgement:
      type: object
      properties:
        data:
          type: object
          properties:
            success:
              type: boolean
            message:
              type: string
    WebhookResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/Webhook'
    CreateWebhookRequest:
      type: object
      required:
      - url
      - triggers
      properties:
        url:
          type: string
          format: uri
        method:
          type: string
          enum:
          - POST
          - GET
        triggers:
          type: array
          items:
            type: string
            description: e.g. message_sent, user_created, group_member_added.
        authentication:
          type: object
          properties:
            type:
              type: string
              enum:
              - basic
              - none
            username:
              type: string
            password:
              type: string
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: apikey
      description: Rest API Key with fullAccess scope from the CometChat dashboard. The App ID and region are encoded in the host, not in a header.