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

# Send a WhatsApp message

> Send a session text message or an approved WhatsApp template. Text messages require an open customer-service window; templates can start a conversation. GreenTick templates use named variables only. The to field is cleaned to digits and validated with country code (same rules as dashboard contacts) before calling WhatsApp. Template requests may include scheduledAt. An offset or Z is stored as that instant. A value without a zone is read in the account profile timezone from GET /api-key. Text messages cannot be scheduled.



## OpenAPI

````yaml /openapi.json post /messages
openapi: 3.1.0
info:
  title: GreenTick Developer API
  version: 1.0.0
  summary: WhatsApp messaging, contacts, workflows, and webhooks
  description: >-
    Use GreenTick's REST API to send WhatsApp messages, synchronize contacts,
    trigger workflows, and receive signed event webhooks. Each API key belongs
    to one connected phone number.
  contact:
    name: GreenTick Support
    url: https://greentick.ai
servers:
  - url: https://api.greentick.ai/v1
    description: GreenTick API v1
security: []
tags:
  - name: System
    description: Health and API metadata
  - name: Messages
    description: Send WhatsApp messages
  - name: Conversations
    description: List inbox threads and fetch message history
  - name: Templates
    description: Discover approved templates and their variables
  - name: Contacts
    description: Synchronize customer contacts
  - name: Labels
    description: Contact label catalog for the connected phone number
  - name: Attributes
    description: Contact custom attribute definitions for the connected phone number
  - name: Phone numbers
    description: WhatsApp sending line for this phone number
  - name: Automations
    description: List enrollable automations and start one for a contact
  - name: Workflow hooks
    description: Trigger GreenTick automations from external systems
  - name: Webhooks
    description: Subscribe Zapier, Make.com, or your own server to GreenTick events
  - name: API key
    description: Check the Bearer API key and account timezone
  - name: MCP platform
    description: Limits, usage, and shared connector behavior
  - name: Media
    description: Host customer-supplied files
  - name: Workflows
    description: Create, publish, and export automations
  - name: Flows
    description: WhatsApp Flows
  - name: AI bots
    description: AI bots and knowledge
  - name: Broadcasts
    description: Template broadcasts
  - name: Catalogs
    description: Commerce catalogs, products, and orders
  - name: Ads
    description: Click-to-WhatsApp ads and conversions
paths:
  /messages:
    post:
      tags:
        - Messages
      summary: Send a WhatsApp message
      description: >-
        Send a session text message or an approved WhatsApp template. Text
        messages require an open customer-service window; templates can start a
        conversation. GreenTick templates use named variables only. The to field
        is cleaned to digits and validated with country code (same rules as
        dashboard contacts) before calling WhatsApp. Template requests may
        include scheduledAt. An offset or Z is stored as that instant. A value
        without a zone is read in the account profile timezone from GET
        /api-key. Text messages cannot be scheduled.
      operationId: sendMessage
      requestBody:
        required: true
        content:
          application/json:
            schema:
              oneOf:
                - $ref: '#/components/schemas/TextMessageRequest'
                - $ref: '#/components/schemas/TemplateMessageRequest'
              discriminator:
                propertyName: type
            examples:
              text:
                summary: 'Example: Text message'
                value:
                  to: '919876543210'
                  type: text
                  phoneNumberRef: 668f1a2b3c4d5e6f7a8b9c0a
                  text: Hello from GreenTick
              templateSimple:
                summary: 'Example: Template with named variables'
                value:
                  to: '919876543210'
                  type: template
                  phoneNumberRef: 668f1a2b3c4d5e6f7a8b9c0a
                  template:
                    name: order_update
                    language: en_US
                    variables:
                      customer_name: Akshay
                      order_id: ord_123
              templateMediaHeader:
                summary: 'Example: Template with image header'
                value:
                  to: '919876543210'
                  type: template
                  phoneNumberRef: 668f1a2b3c4d5e6f7a8b9c0a
                  template:
                    name: promo_banner
                    language: en_US
                    variables:
                      offer: 20% OFF
                    headerMediaUrl: https://example.com/banner.jpg
              templateDynamicUrl:
                summary: 'Example: Template with dynamic URL button'
                value:
                  to: '919876543210'
                  type: template
                  phoneNumberRef: 668f1a2b3c4d5e6f7a8b9c0a
                  template:
                    name: order_update
                    language: en_US
                    variables:
                      customer_name: Akshay
                      order_id: ord_123
                    dynamicURLVariable: ord_123
              templateCopyCode:
                summary: 'Example: Template with copy code button'
                value:
                  to: '919876543210'
                  type: template
                  phoneNumberRef: 668f1a2b3c4d5e6f7a8b9c0a
                  template:
                    name: winter_sale_coupon
                    language: en_US
                    variables:
                      customer_name: Akshay
                      discount: 30%
                    copyCodeVariable: WINTER25
      responses:
        '201':
          description: Message accepted by WhatsApp
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MessageResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
      security:
        - apiKey: []
components:
  schemas:
    TextMessageRequest:
      type: object
      required:
        - to
        - type
        - text
        - phoneNumberRef
      properties:
        to:
          type: string
          example: '919876543210'
          description: >-
            Recipient phone with country code. Non-digits are stripped and
            leading zeros removed, then validated (e.g. +91 98765 43210 →
            919876543210). Invalid numbers return 400 INVALID_TO.
        type:
          type: string
          const: text
        text:
          type: string
          maxLength: 4096
        phoneNumberRef:
          type: string
          description: GreenTick phone line ref from GET /phone-numbers (ref field).
          example: 668f1a2b3c4d5e6f7a8b9c0a
    TemplateMessageRequest:
      type: object
      required:
        - to
        - type
        - phoneNumberRef
        - template
      properties:
        to:
          type: string
          example: '919876543210'
          description: >-
            Recipient phone with country code. Non-digits are stripped and
            leading zeros removed, then validated (e.g. +91 98765 43210 →
            919876543210). Invalid numbers return 400 INVALID_TO.
        type:
          type: string
          const: template
        phoneNumberRef:
          type: string
          description: GreenTick phone line ref from GET /phone-numbers (ref field).
          example: 668f1a2b3c4d5e6f7a8b9c0a
        template:
          type: object
          required:
            - name
            - language
          properties:
            name:
              type: string
              example: order_update
            language:
              description: >-
                Template language code. Name + language uniquely identifies the
                template.
              oneOf:
                - type: string
                  example: en_US
                - type: object
                  required:
                    - code
                  properties:
                    code:
                      type: string
                      example: en_US
            variables:
              type: object
              additionalProperties:
                type: string
              description: >-
                Named variable map for header and body placeholders. Keys must
                match variables[].name from GET /templates (e.g. customer_name,
                order_id). Button-specific values use
                template.dynamicURLVariable and template.copyCodeVariable.
              example:
                customer_name: Akshay
                order_id: ord_123
            dynamicURLVariable:
              type: string
              description: >-
                Suffix value for dynamic URL buttons ({{1}}). Required when GET
                /templates returns requiresDynamicURLVariable: true.
              example: ord_123
            copyCodeVariable:
              type: string
              maxLength: 20
              description: >-
                Coupon or code copied to the clipboard. Required when GET
                /templates returns requiresCopyCodeVariable: true. Max 20
                characters.
              example: WINTER25
            headerMediaUrl:
              type: string
              description: >-
                Optional public URL for header media when the template has an
                IMAGE, VIDEO, or DOCUMENT header. When omitted, GreenTick sends
                the template's approved sample media (header.example). Required
                only when GET /templates returns header.requiresMediaUrl: true.
                GreenTick verifies type and size before send: JPEG/PNG max 5 MB,
                MP4 max 16 MB, PDF max 100 MB.
              example: https://example.com/banner.jpg
        scheduledAt:
          type: string
          description: >-
            Optional ISO datetime for a template only. Include an offset or Z to
            store that instant, for example 2026-10-25T09:00:00-04:00. Without a
            zone, the time is read in the account profile timezone. Must be at
            least 5 minutes from now and within 30 days. A success returns
            scheduled, scheduledAt, and scheduledId and does not mean the
            message was delivered.
          example: '2026-10-25T09:00:00+05:30'
    MessageResponse:
      type: object
      properties:
        success:
          type: boolean
          example: true
        data:
          type: object
          properties:
            messageId:
              type: string
            wamid:
              type: string
              description: WhatsApp message ID
            conversationId:
              type: string
            message:
              $ref: '#/components/schemas/ConversationMessage'
    ConversationMessage:
      type: object
      description: >-
        Normalized message row. Returned on POST /messages (data.message) and in
        GET /conversations/{id}/messages.
      properties:
        id:
          type: string
        wamid:
          type: string
        direction:
          type: string
          enum:
            - inbound
            - outbound
        type:
          type: string
          description: text | template | image | video | document | audio | sticker | …
        text:
          type: string
          description: Human-readable preview text.
        createdAt:
          type: string
          format: date-time
        deliveryStatus:
          type: string
          nullable: true
          enum:
            - pending
            - sent
            - delivered
            - read
            - failed
            - deleted
            - null
          description: Latest outbound delivery state.
        deliveryHistory:
          type: array
          items:
            $ref: '#/components/schemas/MessageDeliveryHistoryEntry'
        repliedBy:
          type: string
        template:
          allOf:
            - $ref: '#/components/schemas/MessageTemplatePayload'
          nullable: true
        mediaId:
          type: string
        isRevoked:
          type: boolean
    MessageDeliveryHistoryEntry:
      type: object
      description: >-
        One delivery state change on an outbound message, ordered oldest to
        newest.
      required:
        - status
        - timestamp
      properties:
        status:
          type: string
          enum:
            - pending
            - sent
            - delivered
            - read
            - failed
            - deleted
        timestamp:
          type: string
          format: date-time
        errorCode:
          type: integer
          nullable: true
          description: Meta error code when status is failed.
        errorTitle:
          type: string
          description: Short error title when status is failed.
        errorMessage:
          type: string
          description: Human-readable error detail when status is failed.
    MessageTemplatePayload:
      type: object
      description: >-
        Sent template snapshot on template messages. Not the same as the GET
        /templates catalog object.
      properties:
        name:
          type: string
          example: order_update
        language:
          type: string
          example: en_US
        templateCategory:
          type: string
          enum:
            - MARKETING
            - UTILITY
            - AUTHENTICATION
        parameterFormat:
          type: string
          const: NAMED
        components:
          type: array
          description: >-
            Approved Meta template structure (HEADER, BODY, FOOTER, BUTTONS)
            with placeholders.
          items:
            type: object
            additionalProperties: true
        variableValues:
          type: object
          additionalProperties:
            type: string
          description: Resolved named variables used when the message was sent.
          example:
            customer_name: Akshay
            order_id: ord_123
        headerComponent:
          type: object
          nullable: true
          description: >-
            Send-time header component for media headers (image/video/document
            link or id).
          additionalProperties: true
  responses:
    BadRequest:
      description: Invalid request
      content:
        application/json:
          schema:
            type: object
            required:
              - success
              - code
              - message
            properties:
              success:
                type: boolean
                example: false
              code:
                type: string
                example: INVALID_TO
              message:
                type: string
                example: to (E.164 phone) is required
    Unauthorized:
      description: Missing, invalid, or revoked API key
      content:
        application/json:
          schema:
            type: object
            required:
              - success
              - code
              - message
            properties:
              success:
                type: boolean
                example: false
              code:
                type: string
                example: INVALID_TO
              message:
                type: string
                example: to (E.164 phone) is required
    Forbidden:
      description: >-
        Plan expired (PLAN_EXPIRED) or phone number is not this API key’s
        connected phone number
      content:
        application/json:
          schema:
            type: object
            required:
              - success
              - code
              - message
            properties:
              success:
                type: boolean
                example: false
              code:
                type: string
                example: INVALID_TO
              message:
                type: string
                example: to (E.164 phone) is required
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      bearerFormat: gt_live_…
      description: >-
        Create an API key in GreenTick Developer settings. Send it as
        Authorization: Bearer gt_live_… (Bearer prefix required).

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.