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

# Send a Whatsapp message



## OpenAPI

````yaml https://telnyx-openapi-ng.s3.us-east-1.amazonaws.com/messaging/messages.yml post /messages/whatsapp
openapi: 3.1.0
info:
  title: Telnyx Messages API
  version: 2.0.0
  description: API for sending and retrieving messages.
  contact:
    email: support@telnyx.com
servers:
  - url: https://api.telnyx.com/v2
security:
  - bearerAuth: []
paths:
  /messages/whatsapp:
    post:
      tags:
        - Whatsapp messaging
      summary: Send a Whatsapp message
      operationId: SendWhatsappMessage
      requestBody:
        description: Whatsapp message body
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WhatsappMessage'
        required: true
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WhatsappResponse'
        4XX:
          $ref: '#/components/responses/messaging_GenericErrorResponse'
      x-codeSamples:
        - lang: JavaScript
          source: |-
            import Telnyx from 'telnyx';

            const client = new Telnyx({
              apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
            });

            const response = await client.messages.sendWhatsapp({
              from: '+13125551234',
              to: '+13125551234',
              whatsapp_message: {},
            });

            console.log(response.data);
        - lang: Python
          source: |-
            import os
            from telnyx import Telnyx

            client = Telnyx(
                api_key=os.environ.get("TELNYX_API_KEY"),  # This is the default and can be omitted
            )
            response = client.messages.send_whatsapp(
                from_="+13125551234",
                to="+13125551234",
                whatsapp_message={},
            )
            print(response.data)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/team-telnyx/telnyx-go\"\n\t\"github.com/team-telnyx/telnyx-go/option\"\n)\n\nfunc main() {\n\tclient := telnyx.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tresponse, err := client.Messages.SendWhatsapp(context.TODO(), telnyx.MessageSendWhatsappParams{\n\t\tFrom:            \"+13125551234\",\n\t\tTo:              \"+13125551234\",\n\t\tWhatsappMessage: telnyx.WhatsappMessageContentParam{},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.Data)\n}\n"
        - lang: Java
          source: |-
            package com.telnyx.sdk.example;

            import com.telnyx.sdk.client.TelnyxClient;
            import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
            import com.telnyx.sdk.models.messages.MessageSendWhatsappParams;
            import com.telnyx.sdk.models.messages.MessageSendWhatsappResponse;
            import com.telnyx.sdk.models.messages.WhatsappMessageContent;

            public final class Main {
                private Main() {}

                public static void main(String[] args) {
                    TelnyxClient client = TelnyxOkHttpClient.fromEnv();

                    MessageSendWhatsappParams params = MessageSendWhatsappParams.builder()
                        .from("+13125551234")
                        .to("+13125551234")
                        .whatsappMessage(WhatsappMessageContent.builder().build())
                        .build();
                    MessageSendWhatsappResponse response = client.messages().sendWhatsapp(params);
                }
            }
        - lang: Ruby
          source: >-
            require "telnyx"


            telnyx = Telnyx::Client.new(api_key: "My API Key")


            response = telnyx.messages.send_whatsapp(from: "+13125551234", to:
            "+13125551234", whatsapp_message: {})


            puts(response)
        - lang: CLI
          source: |-
            telnyx messages send-whatsapp \
              --api-key 'My API Key' \
              --from +13125551234 \
              --to +13125551234 \
              --whatsapp-message '{}'
components:
  schemas:
    WhatsappMessage:
      required:
        - from
        - to
        - whatsapp_message
      type: object
      properties:
        from:
          type: string
          description: Phone number in +E.164 format associated with Whatsapp account
          example: '+13125551234'
        to:
          type: string
          description: Phone number in +E.164 format
          example: '+13125551234'
        whatsapp_message:
          $ref: '#/components/schemas/WhatsappMessageContent'
        type:
          type: string
          description: Message type - must be set to "WHATSAPP"
          example: WHATSAPP
          enum:
            - WHATSAPP
        webhook_url:
          description: The URL where webhooks related to this message will be sent.
          type: string
          format: url
        messaging_profile_id:
          description: >-
            Messaging profile ID - required if the 'from' number is not
            SMS-enabled
          type: string
          format: uuid
    WhatsappResponse:
      type: object
      properties:
        data:
          type: object
          properties:
            record_type:
              type: string
              example: message
            direction:
              type: string
              example: outbound
            id:
              type: string
              description: message ID
              example: 4031938e-60e4-4235-a8dd-0b1c55a23e7a
            type:
              type: string
              example: WHATSAPP
            organization_id:
              type: string
              example: 9f61d8e1-7687-4d6d-9cae-9ff682985983
            messaging_profile_id:
              type: string
              example: 4001781e-626f-4a41-a914-b1b682150f94
            from:
              type: object
              properties:
                phone_number:
                  type: string
                  description: >-
                    Sending address (+E.164 formatted phone number, alphanumeric
                    sender ID, or short code).
                  x-format: address
                status:
                  type: string
                  enum:
                    - received
                    - delivered
                carrier:
                  type: string
                  description: The carrier of the sender.
                line_type:
                  type: string
                  description: The line-type of the sender.
                  enum:
                    - Wireline
                    - Wireless
                    - VoWiFi
                    - VoIP
                    - Pre-Paid Wireless
                    - ''
            to:
              $ref: '#/components/schemas/RCSTo'
            body:
              $ref: '#/components/schemas/WhatsappMessageContent'
            encoding:
              type: string
              example: utf-8
            received_at:
              type: string
              format: date-time
            wait_seconds:
              type:
                - number
                - 'null'
              format: float
              description: >-
                Seconds the message is queued due to rate limiting before being
                sent to the carrier. Represents the maximum wait across all
                applicable rate limits (account, carrier, campaign). 0.0 = no
                queuing delay.
              example: 0.5
    WhatsappMessageContent:
      type: object
      properties:
        audio:
          $ref: '#/components/schemas/WhatsappMedia'
        document:
          $ref: '#/components/schemas/WhatsappMedia'
        image:
          $ref: '#/components/schemas/WhatsappMedia'
        sticker:
          $ref: '#/components/schemas/WhatsappMedia'
        video:
          $ref: '#/components/schemas/WhatsappMedia'
        interactive:
          $ref: '#/components/schemas/WhatsappInteractive'
        location:
          $ref: '#/components/schemas/WhatsappLocation'
        contacts:
          type: array
          items:
            $ref: '#/components/schemas/WhatsappContact'
        reaction:
          $ref: '#/components/schemas/WhatsappReaction'
        biz_opaque_callback_data:
          type: string
          description: custom data to return with status update
        type:
          type: string
          enum:
            - audio
            - document
            - image
            - sticker
            - video
            - interactive
            - location
            - template
            - reaction
            - contacts
            - text
        text:
          type: object
          description: >-
            Text message content. Can only be sent within a 24-hour customer
            service window.
          properties:
            body:
              type: string
              description: The text message body.
              example: Hello from Telnyx!
            preview_url:
              type: boolean
              description: Whether to show a URL preview in the message.
              default: false
          required:
            - body
        template:
          type: object
          description: >-
            Template message object. Provide either template_id or name +
            language to identify the template.
          properties:
            template_id:
              type: string
              description: >-
                Telnyx template ID (the id field from template list/get
                responses). When provided, name and language are resolved
                automatically.
              example: 019cd44b-3a1c-781b-956e-bd33e9fd2ac6
            name:
              type: string
              description: >-
                Template name as registered with Meta. Required unless
                template_id is provided.
              example: order_confirmation
            language:
              type: object
              description: Template language. Required unless template_id is provided.
              properties:
                policy:
                  type: string
                  example: deterministic
                code:
                  type: string
                  description: Language code (e.g. en_US)
                  example: en_US
              required:
                - code
            components:
              type: array
              description: >-
                Template parameter values for header, body, and button
                components.
              items:
                type: object
                properties:
                  type:
                    type: string
                    enum:
                      - header
                      - body
                      - button
                  sub_type:
                    type: string
                    enum:
                      - quick_reply
                      - url
                  index:
                    type: integer
                    description: Button index (required for button components)
                  parameters:
                    type: array
                    items:
                      type: object
                      properties:
                        type:
                          type: string
                          enum:
                            - text
                            - image
                            - video
                            - document
                            - currency
                            - date_time
                        text:
                          type: string
    RCSTo:
      type: array
      items:
        $ref: '#/components/schemas/RCSToItem'
    messaging_Errors:
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/messaging_Error'
    WhatsappMedia:
      type: object
      properties:
        link:
          type: string
          description: media URL
          format: url
          example: http://example.com/media.jpg
        caption:
          type: string
          description: media caption
        filename:
          type: string
          description: file name with extension
        voice:
          type: boolean
          description: true if voice message
    WhatsappInteractive:
      type: object
      properties:
        type:
          type: string
          enum:
            - cta_url
            - list
            - carousel
            - button
            - location_request_message
        action:
          type: object
          properties:
            name:
              type: string
            button:
              type: string
            buttons:
              type: array
              items:
                type: object
                properties:
                  type:
                    type: string
                    enum:
                      - reply
                  reply:
                    type: object
                    properties:
                      title:
                        type: string
                        description: button label, 20 character maximum
                      id:
                        type: string
                        description: >-
                          unique identifier for each button, 256 character
                          maximum
            catalog_id:
              type: string
            product_retailer_id:
              type: string
            sections:
              type: array
              items:
                type: object
                properties:
                  product_items:
                    type: array
                    items:
                      type: object
                      properties:
                        product_retailer_id:
                          type: string
                  rows:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          description: >-
                            arbitrary string identifying the row, 200 character
                            maximum
                        title:
                          type: string
                          description: row title, 24 character maximum
                        description:
                          type: string
                          description: row description, 72 character maximum
                  title:
                    type: string
                    description: section title, 24 character maximum
            mode:
              type: string
            parameters:
              type: object
              properties:
                display_text:
                  type: string
                  description: button label text, 20 character maximum
                url:
                  type: string
                  format: url
                  description: button URL to load when tapped by the user
            cards:
              type: array
              items:
                type: object
                properties:
                  card_index:
                    type: integer
                    description: unique index for each card (0-9)
                  type:
                    type: string
                    enum:
                      - cta_url
                  header:
                    type: object
                    properties:
                      type:
                        type: string
                        enum:
                          - image
                          - video
                      image:
                        $ref: '#/components/schemas/WhatsappMedia'
                      video:
                        $ref: '#/components/schemas/WhatsappMedia'
                  body:
                    type: object
                    properties:
                      text:
                        type: string
                        description: 160 character maximum, up to 2 line breaks
                  action:
                    type: object
                    properties:
                      product_retailer_id:
                        type: string
                        description: the unique retailer ID of the product
                      catalog_id:
                        type: string
                        description: the unique ID of the catalog
        body:
          type: object
          properties:
            text:
              type: string
              description: body text, 1024 character maximum
        footer:
          type: object
          properties:
            text:
              type: string
              description: footer text, 60 character maximum
        header:
          type: object
          properties:
            document:
              $ref: '#/components/schemas/WhatsappMedia'
            image:
              $ref: '#/components/schemas/WhatsappMedia'
            video:
              $ref: '#/components/schemas/WhatsappMedia'
            text:
              type: string
              description: header text, 60 character maximum
            sub_text:
              type: string
    WhatsappLocation:
      type: object
      properties:
        latitude:
          type: string
        longitude:
          type: string
        name:
          type: string
        address:
          type: string
    WhatsappContact:
      type: object
      properties:
        addresses:
          type: array
          items:
            type: object
            properties:
              street:
                type: string
              city:
                type: string
              state:
                type: string
              zip:
                type: string
              country:
                type: string
              country_code:
                type: string
              type:
                type: string
        birthday:
          type: string
        emails:
          type: array
          items:
            type: object
            properties:
              email:
                type: string
              type:
                type: string
        name:
          type: string
        org:
          type: object
          properties:
            company:
              type: string
            department:
              type: string
            title:
              type: string
        phones:
          type: array
          items:
            type: object
            properties:
              phone:
                type: string
                x-format: E+164
              type:
                type: string
              wa_id:
                type: string
        urls:
          type: array
          items:
            type: object
            properties:
              url:
                type: string
                format: url
              type:
                type: string
    WhatsappReaction:
      type: object
      properties:
        message_id:
          type: string
        emoji:
          type: string
    RCSToItem:
      type: object
      properties:
        phone_number:
          type: string
          example: '+13125551234'
        status:
          type: string
          example: queued
        carrier:
          type: string
          example: Verizon Wireless
        line_type:
          type: string
          example: Wireless
    messaging_Error:
      required:
        - code
        - title
      properties:
        code:
          type: string
          x-format: integer
        title:
          type: string
        detail:
          type: string
        source:
          type: object
          properties:
            pointer:
              description: JSON pointer (RFC6901) to the offending entity.
              type: string
              format: json-pointer
            parameter:
              description: Indicates which query parameter caused the error.
              type: string
        meta:
          type: object
  responses:
    messaging_GenericErrorResponse:
      description: Unexpected error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/messaging_Errors'
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````