> ## Documentation Index
> Fetch the complete documentation index at: https://docs.multchats.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Cadastrar Webhook

> Cadastra um webhook para receber notificações de eventos de uma integração.



## OpenAPI

````yaml POST /integration/webhook/create
openapi: 3.1.0
info:
  title: OpenAPI Multchats
  description: Multchats API
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.multchats.com/v2
security:
  - bearerAuth: []
paths:
  /integration/webhook/create:
    post:
      tags:
        - Integration
      summary: Cadastrar Webhook
      description: >-
        Cadastra um webhook para receber notificações de eventos de uma
        integração.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateIntegrationWebhookRequest'
      responses:
        '200':
          description: Webhook cadastrado com sucesso
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateIntegrationWebhookResponse'
        '400':
          description: Erro na requisição
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    CreateIntegrationWebhookRequest:
      type: object
      required:
        - integrationId
        - url
        - method
        - type
      properties:
        integrationId:
          description: ID da integração
          type: string
          pattern: ^c[a-z0-9]{24}$
        url:
          description: URL do webhook
          type: string
          format: uri
        method:
          description: Método HTTP
          type: string
          enum:
            - GET
            - POST
            - PUT
            - DELETE
            - PATCH
        headers:
          description: Cabeçalhos HTTP adicionais
          type: array
          items:
            type: object
            required:
              - key
              - value
            properties:
              key:
                description: Nome do cabeçalho
                type: string
              value:
                description: Valor do cabeçalho
                type: string
        type:
          description: Tipo de evento que dispara o webhook
          type: string
          enum:
            - MESSAGE_SENT_AND_RECEIVED
            - MESSAGE_SENT
            - MESSAGE_RECEIVED
            - FIRST_MESSAGE_RECEIVED
            - MESSAGE_IN_SERVICE
            - CONNECTION_STATUS_UPDATE
            - SERVICE_CONTINUITY_VERIFICATION
        delayMinutes:
          description: Atraso em minutos antes de disparar o webhook
          type: integer
          minimum: 0
        transferType:
          description: Tipo de transferência para filtrar o disparo do webhook
          type: string
          enum:
            - ALL
            - USER
            - AUTOMATION
            - API
            - AUTOMATION_AND_API
    CreateIntegrationWebhookResponse:
      type: object
      properties:
        success:
          description: Indica se a operação foi bem-sucedida
          type: boolean
          default: true
        response:
          type: object
          properties:
            webhook:
              $ref: '#/components/schemas/IntegrationWebhook'
    Error:
      required:
        - success
        - message
      type: object
      properties:
        success:
          description: Indica se a operação foi bem-sucedida
          type: boolean
          default: false
        message:
          description: Mensagem de erro (quando success é false)
          type: string
          default: Erro ao enviar mensagem
    IntegrationWebhook:
      type: object
      properties:
        id:
          description: ID do webhook
          type: string
        integrationId:
          description: ID da integração
          type: string
        url:
          description: URL do webhook
          type: string
        method:
          description: Método HTTP
          type: string
        type:
          description: Tipo do webhook
          type: string
        headers:
          description: Cabeçalhos HTTP
          type: array
        delayMinutes:
          description: Atraso em minutos
          type: integer
        transferType:
          description: Tipo de transferência
          type: string
        createdAt:
          description: Data de criação
          type: string
        updatedAt:
          description: Data de atualização
          type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````