Pingtochat Docs

Pingtochat Docs

Did You Know?

Docy turns out that context is a key part of learning.

leafleafleafDocy banner shape 01Docy banner shape 02Man illustrationFlower illustration

Parameter with body buttons – phone-number

Estimated reading: 3 minutes 66 views

Overview

  • A body containing the main message text with placeholders for dynamic content.
  • A Phone Number for calling

For Phone Number buttons, they do not need to be included in the Example payload.

This template is suitable for transactional updates with an easy opt-out option.

Endpoint:

http://{{your_domain}}/api/v1.0/{{phone_number_id}}/{{key}}/messages
Replace placeholders:

{{key}}: Your API key for authentication.How to create key

{{your_domain}}: Your domain URL where the API is hosted.

{{phone_number_id}}: The unique identifier of the phone number used for sending messages.

Method:s

POST

Headers:

  • Content-Type: application/json
  • Authorization: Bearer <your_access_token>

Example Payload:

{
    "messaging_product": "whatsapp",
    "recipient_type": "individual",
    "to": "91xxxxxxxxxx",
    "type": "template",
    "template": {
        "name": "utility_ah",
        "language": {
            "code": "en_us"
        },
        "components": [
            {
                "type": "body",
                "parameters": [
                    {
                        "type": "text",
                        "text": "12CR007"
                    }
                ]
            }
        ]
    }
}

Explanation of Fields

messaging_product

  • Type: string
  • Value: "whatsapp"
  • Description: Defines the messaging platform.

recipient_type

  • Type: string
  • Value: "individual"
  • Description: Indicates a one-on-one message.

to

  • Type: string
  • Example: "91xxxxxxxxxx"
  • Description: The recipient’s WhatsApp number in international format.

type

  • Type: string
  • Value: "template"
  • Description: Defines this as a template message.

template.name

  • Type: string
  • Value: "utility_ah"
  • Description: Name of the pre-approved WhatsApp template.

template.language.code

  • Type: string
  • Value: "en_us"
  • Description: Language of the template.

components

  • Type: array
  • Description: Contains message elements.

Body Component

  • Type: "body"
  • Description: Contains the main message text.
  • Parameters:
    • Type: "text"
    • Value: "12CR007" – Dynamic text inserted into the message.

Expected API Response

On success, WhatsApp returns a 200 OK response:

{
  "messaging_product": "whatsapp",
  "contacts": [
    {
      "input": "91xxxxxxxxxx",
      "wa_id": "91xxxxxxxxxx",
      "status_id": "NTg0MTc="
    }
  ],
  "messages": [
    {
      "id": "M2s4da2y4P",
      "message_status": "accepted"
    }
  ]
}

Response Field Descriptions

messaging_product

  • Type: String
  • Description: Always returns "whatsapp".

contacts

  • Type: `Array**
  • Description: Contains recipient details.

Fields within contacts:

  • input: The phone number used in the API request.
  • wa_id: WhatsApp ID linked to the phone number.
  • status_id: A unique identifier for message status.

messages

  • Type: `Array**
  • Description: Contains details about the sent message.

Fields within messages:

  • id: A unique message identifier.
  • message_status: Indicates the message processing status.
    • "accepted": The message was successfully processed.

Sample codes

Leave a Comment

Share this Doc

Parameter with body buttons – phone-number

Or copy link

CONTENTS