openapi: 3.1.0

info:
  title: Hello24 Custom API
  version: "1.0.0"
  license:
    name: Proprietary
    url: https://hello24.ai/
  summary: Hello24 Custom API for messaging and webhook integrations
  description: |

    The Hello24 API enables applications to communicate with customers over
    WhatsApp using the WhatsApp Business Platform.

    ## Features

    - Send WhatsApp Template Messages
    - Send Plain Text Messages
    - Configure Webhooks
    - Receive Incoming Customer Messages
    - Receive Message Status Events (Sent, Delivered, Read and Failed)

    ## Base URL

    ```
    https://api.hello24.in/prod
    ```

    All API endpoints are versioned.

    Current API version:

    ```
    /v1
    ```

    Example endpoint:

    ```
    POST https://api.hello24.in/prod/v1/sendTemplateMessage
    ```

    ## Authentication

    Every API request must include your Hello24 API key in the request header.

    ```
    Header:

    HELLO24_API_KEY: YOUR_API_KEY
    ```

    API keys can be generated from the Hello24 Portal under:

    **Integrations → Custom API Integration**

    ## Response Format

    The API always returns JSON.

    Successful requests return:

    - `code = SUCCESS`

    Failed requests return:

    - `code = FAILURE`

    For message sending APIs, an HTTP 200 response only indicates that Hello24 successfully received your request.

    Always inspect the response body to determine whether the message was accepted or rejected.

    ## Webhooks

    After configuring a webhook URL, Hello24 sends HTTP POST requests to your endpoint for:

    - Incoming customer messages
    - Message sent
    - Message delivered
    - Message read
    - Message failed

    Your webhook endpoint should respond with HTTP 200 after successfully processing each event.

    ## Phone Number Format

    Phone numbers should include the country code without spaces or special
    characters.

    Example:

    ```
    919876543210
    ```

servers:
  - url: https://api.hello24.in/prod
    description: Hello24 API Base URL

tags:
  - name: Messages
    description: |
      Send WhatsApp messages to customers.

      Includes template messages and free-form text messages.
  - name: Webhooks
    description: |
      Configure webhook endpoints to receive message lifecycle events.

security:
  - ApiKeyAuth: []

paths: 
  /v1/sendTemplateMessage:
    post:
      tags:
        - Messages
      operationId: sendTemplateMessage
      summary: Send a WhatsApp template message
      description: |
        Sends a pre-approved WhatsApp template message to a recipient.

        Template messages can be used to:

        - Start a new conversation with a customer.
        - Re-engage customers after the 24-hour customer service window has expired.
        - Send transactional, authentication or marketing notifications using approved WhatsApp templates.

        Each request references an approved template and can optionally include values
        for template variables.

        ## Template Components

        A template may contain one or more of the following components:

        | Component | Required | Description |
        |-----------|----------|-------------|
        | Header | No | Text, image, video or PDF document. |
        | Body | Usually | Variables used in the template body. |
        | CTA Buttons | No | Dynamic parameters for call-to-action buttons. |
        | Quick Reply Buttons | No | Options customers can tap to send a predefined response. |

        The values supplied in the request must match the template definition
        approved in WhatsApp Business Manager.

        ## Recipient Number

        Provide the recipient's WhatsApp number in international format without
        spaces or special characters.

        Example:

        ```
        919876543210
        ```

        ## Response

        An HTTP **200 OK** response only confirms that Hello24 successfully received
        your request.

        Always inspect the response body:

        - `code = SUCCESS` indicates the message was accepted for delivery.
        - `code = FAILURE` indicates the message was rejected. The response contains one or more errors describing the reason.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SendTemplateMessageRequest'
            examples:
              simpleTemplate:
                summary: Template with body variables
                value:
                  templateName: black_friday_early_bird_access (en)
                  params:
                    body:
                      - John
                      - Shoes
                      - 20%
                      - Tomorrow
                  phone: "919876543210"
              mediaTemplate:
                summary: Template with image header
                value:
                  templateName: promotion_banner (en)
                  params:
                    header:
                      - https://example.com/banner.jpg
                  phone: "919876543210"
              urlButton:
                summary: Dynamic URL button
                value:
                  templateName: order_tracking (en)
                  params:
                    body:
                      - "12345"
                    buttons:
                      - "12345"
                  phone: "919876543210"
              quickReply:
                summary: Quick reply buttons
                value:
                  templateName: order_confirmation (en)
                  params:
                    header:
                      - John
                    body:
                      - "12345"
                      - Shoes
                      - "100"
                    quick_reply_buttons:
                      - View Order
                      - Unsubscribe
                  phone: "919876543210"
      responses:
        "200":
          description: Request processed successfully.
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/SendMessageSuccessResponse'
                  - $ref: '#/components/schemas/SendMessageFailureResponse'
              examples:
                success:
                  summary: Successful message submission
                  value:
                    code: SUCCESS
                    data:
                      contacts:
                        - input: "919876543210"
                          wa_id: "919876543210"
                      messages:
                        - id: gBEGkXQRF3gGAgl4jbPFezZT6XX
                      meta:
                        api_status: stable
                        version: 2.43.2
                failure:
                  summary: Meta rejected the request
                  value:
                    code: FAILURE
                    data:
                      errors:
                        - code: 1013
                          title: Primary Reason
                          details: Detailed error description
                      meta:
                        api_status: stable
                        version: 2.43.2
        "403":
          description: Invalid API key or unauthorized request.
  /v1/sendTextMessage:
    post:
      tags:
        - Messages
      operationId: sendTextMessage
      summary: Send a WhatsApp text message
      description: |
        Sends a plain text WhatsApp message to a recipient.

        Text messages can only be sent when there is an active customer service
        conversation with the recipient. The conversation remains active for
        24 hours after the customer's last message.

        If no active conversation exists, use the **Send Template Message**
        endpoint to initiate a new conversation.

        ## Recipient Number

        Provide the recipient's WhatsApp number in international format without
        spaces or special characters.

        Example:

        ```
        919876543210
        ```

        ## Response

        An HTTP **200 OK** response only confirms that Hello24 successfully received
        your request.

        Always inspect the response body:

        - `code = SUCCESS` indicates the message was accepted for delivery.
        - `code = FAILURE` indicates the message could not be sent.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - messageText
                - phone
              properties:
                messageText:
                  type: string
                  description: Plain text message to send to the recipient.
                  example: Hi. I am a plain text message.
                phone:
                  type: string
                  description: Recipient's WhatsApp number including country code.
                  example: "919876543210"
            examples:
              simpleMessage:
                summary: Plain text message
                value:
                  messageText: Hi. I am a plain text message.
                  phone: "919876543210"
      responses:
        "200":
          description: Message request processed successfully.
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/SendMessageSuccessResponse'
                  - $ref: '#/components/schemas/SendMessageFailureResponse'
              examples:
                success:
                  summary: Successful request
                  value:
                    code: SUCCESS
                    data:
                      contacts:
                        - input: "919876543210"
                          wa_id: "919876543210"
                      messages:
                        - id: gBEGkXQRF3gGAgl4jbPFezZT6XX
                      meta:
                        api_status: stable
                        version: 2.43.2
                failure:
                  summary: Request validation failed
                  value:
                    code: FAILURE
                    error: The provided input parameters are invalid.
        "403":
          description: Invalid API key or unauthorized request.
  /v1/setWebhook:
    post:
      tags:
        - Webhooks
      operationId: setWebhook
      summary: Configure a webhook endpoint
      description: |
        Registers a webhook URL to receive WhatsApp webhook events.

        Once configured, Hello24 will send HTTP POST requests to this endpoint
        whenever a subscribed WhatsApp event occurs, including:

        - Incoming customer messages
        - Message sent
        - Message delivered
        - Message read
        - Message failed

        The webhook URL must:

        - Use HTTPS.
        - Be publicly accessible.
        - Respond with HTTP 200 OK after successfully processing each webhook event.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - url
              properties:
                url:
                  type: string
                  format: uri
                  description: Public HTTPS endpoint that will receive webhook events from Hello24.
                  example: https://example.com/webhook
            examples:
              setWebhook:
                summary: Register a webhook URL
                value:
                  url: https://example.com/webhook
      responses:
        "200":
          description: Webhook configuration request processed successfully.
          content:
            application/json:
              schema:
                oneOf:
                  - type: object
                    required:
                      - code
                      - data
                    properties:
                      code:
                        type: string
                        enum:
                          - SUCCESS
                      data:
                        type: string
                        example: Webhook has been set up successfully
                  - type: object
                    required:
                      - code
                      - error
                    properties:
                      code:
                        type: string
                        enum:
                          - FAILURE
                      error:
                        type: string
                        example: We accept only url which starts with https (secured).
              examples:
                success:
                  summary: Webhook configured
                  value:
                    code: SUCCESS
                    data: Webhook has been setup succesfully
                invalidUrl:
                  summary: Invalid HTTPS URL
                  value:
                    code: FAILURE
                    error: We accept only url which starts with https (secured).
        "403":
          description: Invalid API key or unauthorized request.
  /v1/removeWebhook:
    post:
      tags:
        - Webhooks
      operationId: removeWebhook
      summary: Remove the configured webhook
      description: |
        Removes the currently configured webhook endpoint for the authenticated account.

        After the webhook is removed, Hello24 will stop sending all webhook events,
        including incoming customer messages and message status updates.

        To resume receiving webhook events, configure a new webhook using the
        **Set Webhook** endpoint.
      responses:
        "200":
          description: Webhook removal request processed successfully.
          content:
            application/json:
              schema:
                oneOf:
                  - type: object
                    required:
                      - code
                      - data
                    properties:
                      code:
                        type: string
                        enum:
                          - SUCCESS
                      data:
                        type: string
                        example: Webhook has been removed successfully
                  - type: object
                    required:
                      - code
                      - error
                    properties:
                      code:
                        type: string
                        enum:
                          - FAILURE
                      error:
                        type: string
                        example: No webhook is configured.
              examples:
                success:
                  summary: Webhook removed
                  value:
                    code: SUCCESS
                    data: Webhook has been removed successfully
                failure:
                  summary: No webhook is configured
                  value:
                    code: FAILURE
                    error: No webhook is configured.
        "403":
          description: Invalid API key or unauthorized request.
  /webhook:
    post:
      tags:
        - Webhooks
      operationId: webhookEvent
      summary: Webhook callback payload
      description: |
        This section describes the HTTP POST payloads that Hello24 sends to your
        configured webhook URL.

        Your application should expose an HTTPS endpoint capable of receiving these
        webhook events.

        Hello24 currently sends webhook events for:

        - Incoming customer messages
        - Message sent
        - Message delivered
        - Message read
        - Message failed

        Message status events can be correlated with your original Send Message API
        request using the returned WhatsApp message ID.

        Your webhook endpoint should return **HTTP 200 OK** after successfully
        processing each event.
      requestBody:
        required: true
        description: Webhook payload sent by Hello24.
        content:
          application/json:
            schema:
              oneOf:
                - $ref: '#/components/schemas/IncomingMessageWebhook'
                - $ref: '#/components/schemas/MessageStatusWebhook'
            examples:
              incomingMessage:
                summary: Incoming customer message
                value:
                  messaging_product: whatsapp
                  metadata:
                    display_phone_number: "918056585189"
                  contacts:
                    - profile:
                        name: V
                      wa_id: "919876543210"
                      user_id: "IN.1274429124825497"
                  messages:
                    - from: "919876543210"
                      from_user_id: "IN.1274429124825497"
                      id: "wamid.HBgHGu5hJUHil79JKhg5kgHLUY2GukJ5HgBGN0FDQzE1REY5QjEzQwA="
                      timestamp: "1785385844"
                      type: text
                      text:
                        body: hi
              messageSent:
                summary: Outbound message status
                value:
                  messaging_product: whatsapp
                  metadata:
                    display_phone_number: "918056585189"
                  contacts:
                    - wa_id: "919876543210"
                      user_id: "IN.1274429124825497"
                  statuses:
                    - id: "wamid.HBgMOTE4MTzFQIAd89DS87SDFERgSNzA5SLDFsdf80SDF09SD08fDS=="
                      status: sent
                      timestamp: "1785385849"
                      recipient_id: "919876543210"
                      recipient_user_id: "IN.1274429124825497"
                      conversation:
                        id: fb4036cdb4e279caf66333aa6951199e
                        expiration_timestamp: "1785385849"
                        origin:
                          type: service
      responses:
        "200":
          description: Return HTTP 200 after successfully processing the webhook event.
        "400":
          description: Invalid webhook payload.

components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: HELLO24_API_KEY
      description: |
        API key generated from the Hello24 Portal.

        Include this header in every request.

        Example:

        ```
        HELLO24_API_KEY: YOUR_API_KEY
        ```
  schemas:
    Contact:
      type: object
      required:
        - input
        - wa_id
      properties:
        input:
          type: string
          description: Phone number provided in the request.
          example: "919876543210"
        wa_id:
          type: string
          description: WhatsApp ID of the recipient.
          example: "919876543210"
    Message:
      type: object
      required:
        - id
      properties:
        id:
          type: string
          description: Unique WhatsApp message identifier.
          example: gBEGkXQRF3gGAgl4jbPFezZT6XX
    Meta:
      type: object
      required:
        - api_status
        - version
      properties:
        api_status:
          type: string
          example: stable
        version:
          type: string
          example: 2.43.2
    ApiError:
      type: object
      required:
        - code
        - title
        - details
      properties:
        code:
          type: integer
          example: 1013
        title:
          type: string
          example: Primary Reason
        details:
          type: string
          example: Detailed error description
    TemplateParams:
      type: object
      description: |
        Values supplied for the variables defined in the approved WhatsApp template.

        Include only the components used by the template.
      properties:
        header:
          type: array
          description: Header variables or media URL.
          items:
            type: string
        body:
          type: array
          description: Body variables in template order.
          items:
            type: string
        buttons:
          type: array
          description: Dynamic URL values for CTA buttons.
          items:
            type: string
        quick_reply_buttons:
          type: array
          description: Payload values for quick reply buttons.
          items:
            type: string
    SendTemplateMessageRequest:
      type: object
      required:
        - templateName
        - phone
      properties:
        templateName:
          type: string
          description: |
            Name of the approved WhatsApp template including the language code.

            Example:

            ```
            welcome_message (en)
            ```
          example: welcome_message (en)
        params:
          $ref: '#/components/schemas/TemplateParams'
        phone:
          type: string
          description: Recipient phone number in international format.
          example: "919876543210"
    SendMessageSuccessResponse:
      type: object
      required:
        - code
        - data
      properties:
        code:
          type: string
          enum:
            - SUCCESS
        data:
          type: object
          required:
            - contacts
            - messages
            - meta
          properties:
            contacts:
              type: array
              items:
                $ref: '#/components/schemas/Contact'
            messages:
              type: array
              items:
                $ref: '#/components/schemas/Message'
            meta:
              $ref: '#/components/schemas/Meta'
    SendMessageFailureResponse:
      oneOf:
        - type: object
          required:
            - code
            - error
          properties:
            code:
              type: string
              enum:
                - FAILURE
            error:
              type: string
              example: The provided input parameters are invalid.
        - type: object
          required:
            - code
            - data
          properties:
            code:
              type: string
              enum:
                - FAILURE
            data:
              type: string
              example: Given Params ... does not match the template.
        - type: object
          required:
            - code
            - data
          properties:
            code:
              type: string
              enum:
                - FAILURE
            data:
              type: object
              properties:
                errors:
                  type: array
                  items:
                    $ref: '#/components/schemas/ApiError'
                meta:
                  $ref: '#/components/schemas/Meta'
    IncomingMessageWebhook:
      allOf:
        - $ref: '#/components/schemas/WebhookBase'
        - type: object
          required:
            - messages
          properties:
            messages:
              type: array
              items:
                $ref: '#/components/schemas/IncomingMessage'
    MessageStatusWebhook:
      allOf:
        - $ref: '#/components/schemas/WebhookBase'
        - type: object
          required:
            - statuses
          properties:
            statuses:
              type: array
              items:
                $ref: '#/components/schemas/MessageStatus'
    IncomingMessage:
      type: object
      properties:
        from:
          type: string
        from_user_id:
          type: string
        id:
          type: string
        timestamp:
          type: string
        type:
          type: string
          example: text
        text:
          type: object
          properties:
            body:
              type: string
    MessageStatus:
      type: object
      properties:
        id:
          type: string
        status:
          type: string
          enum:
            - sent
            - delivered
            - read
            - failed
        timestamp:
          type: string
        recipient_id:
          type: string
        recipient_user_id:
          type: string
        conversation:
          type: object
          properties:
            id:
              type: string
            expiration_timestamp:
              type: string
            origin:
              type: object
              properties:
                type:
                  type: string
                  example: service
    WebhookBase:
      type: object
      required:
        - messaging_product
        - metadata
        - contacts
      properties:
        messaging_product:
          type: string
          example: whatsapp
        metadata:
          type: object
          properties:
            display_phone_number:
              type: string
              example: "918056585189"
        contacts:
          type: array
          items:
            type: object
            properties:
              profile:
                type: object
                properties:
                  name:
                    type: string
                    example: V
              wa_id:
                type: string
              user_id:
                type: string