> ## Documentation Index
> Fetch the complete documentation index at: https://kapso-1adbad2d.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a WhatsApp webhook

> Creates a new webhook for receiving WhatsApp events for this configuration



## OpenAPI

````yaml api/legacy/openapi-platform.yaml post /whatsapp_configs/{whatsapp_config_id}/whatsapp_webhooks
openapi: 3.0.3
info:
  title: Kapso Platform API
  description: >-
    Build WhatsApp automation into your SaaS. Let your customers connect their
    own WhatsApp Business accounts.
  version: 1.0.0
  contact:
    name: Kapso Support
servers:
  - url: https://app.kapso.ai/api/v1
    description: Production server
security:
  - ApiKeyAuth: []
paths:
  /whatsapp_configs/{whatsapp_config_id}/whatsapp_webhooks:
    post:
      tags:
        - WhatsApp Webhooks
      summary: Create a WhatsApp webhook
      description: >-
        Creates a new webhook for receiving WhatsApp events for this
        configuration
      operationId: createPlatformWhatsappWebhook
      parameters:
        - name: whatsapp_config_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - whatsapp_webhook
              properties:
                whatsapp_webhook:
                  type: object
                  required:
                    - url
                    - secret_key
                    - events
                  properties:
                    url:
                      type: string
                      format: uri
                      example: https://example.com/webhook
                      description: The URL that will receive webhook notifications
                    secret_key:
                      type: string
                      example: your-secret-key-here
                      description: Secret key for webhook signature verification
                    events:
                      type: array
                      items:
                        type: string
                      example:
                        - whatsapp.message.received
                        - whatsapp.message.sent
                      description: List of events this webhook should receive
                    active:
                      type: boolean
                      default: true
                      description: Whether this webhook is active
                    headers:
                      type: object
                      additionalProperties:
                        type: string
                      example:
                        X-Custom-Header: custom-value
                      description: Custom headers to include in webhook requests
                    buffer_enabled:
                      type: boolean
                      default: false
                      description: Whether message buffering is enabled for batch delivery
                    buffer_window_seconds:
                      type: integer
                      minimum: 1
                      maximum: 60
                      default: 5
                      description: >-
                        Time window in seconds to buffer messages before sending
                        as batch
                    max_buffer_size:
                      type: integer
                      minimum: 1
                      maximum: 100
                      default: 50
                      description: Maximum number of messages to include in a single batch
                    buffer_events:
                      type: array
                      items:
                        type: string
                      default:
                        - whatsapp.message.received
                      description: >-
                        List of events that should be buffered (currently only
                        supports whatsapp.message.received)
                    inactivity_minutes:
                      type: integer
                      minimum: 1
                      maximum: 1440
                      default: 60
                      description: >-
                        Time in minutes to wait with no messages before
                        triggering whatsapp.conversation.inactive event (1-1440
                        minutes, default 60)
            examples:
              basic_webhook:
                summary: Basic webhook without buffering
                value:
                  whatsapp_webhook:
                    url: https://example.com/webhook
                    secret_key: my-secret-key
                    events:
                      - whatsapp.message.received
                      - whatsapp.message.sent
                    active: true
              webhook_with_buffering:
                summary: Webhook with message buffering enabled
                value:
                  whatsapp_webhook:
                    url: https://example.com/webhook
                    secret_key: my-secret-key
                    events:
                      - whatsapp.message.received
                    active: true
                    buffer_enabled: true
                    buffer_window_seconds: 10
                    max_buffer_size: 25
                    buffer_events:
                      - whatsapp.message.received
      responses:
        '201':
          description: Webhook created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/WhatsappWebhook'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Customer not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    WhatsappWebhook:
      type: object
      properties:
        id:
          type: string
          format: uuid
          example: 9e8d7c6b-5a4f-3e2d-1c0b-9a8f7e6d5c4b
        url:
          type: string
          format: uri
          example: https://example.com/webhook
        secret_key:
          type: string
          example: your-secret-key
          description: Secret key for webhook signature verification
        events:
          type: array
          items:
            type: string
          example:
            - whatsapp.message.received
            - whatsapp.message.sent
          description: List of events this webhook should receive
        active:
          type: boolean
          example: true
          description: Whether this webhook is active
        headers:
          type: object
          additionalProperties:
            type: string
          nullable: true
          example:
            X-Custom-Header: custom-value
          description: Custom headers to include in webhook requests
        buffer_enabled:
          type: boolean
          example: false
          description: Whether message buffering is enabled for batch delivery
        buffer_window_seconds:
          type: integer
          minimum: 1
          maximum: 60
          example: 5
          description: Time window in seconds to buffer messages before sending as batch
        max_buffer_size:
          type: integer
          minimum: 1
          maximum: 100
          example: 50
          description: Maximum number of messages to include in a single batch
        buffer_events:
          type: array
          items:
            type: string
          example:
            - whatsapp.message.received
          description: >-
            List of events that should be buffered (currently only supports
            whatsapp.message.received)
        inactivity_minutes:
          type: integer
          minimum: 1
          maximum: 1440
          example: 60
          description: >-
            Time in minutes to wait with no messages before triggering
            whatsapp.conversation.inactive event (1-1440 minutes, default 60)
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    Error:
      type: object
      properties:
        error:
          type: string
          example: Resource not found
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: Your project API key

````