Pingtochat Docs

Pingtochat Docs

Did You Know?

Advanced visual search system powered by Ajax

leafleafleafDocy banner shape 01Docy banner shape 02Man illustrationFlower illustration

Message with parameters,header ,body ,footer and with buttons

Estimated reading: 3 minutes 72 views

PingtoChat’s Marketing Category enables businesses to send pre-approved WhatsApp template messages through the WhatsApp Business API. The supported message types include:

  1. Messages Without Parameters
  2. Messages With Parameters
  3. Messages With Parameters and Attachments
  4. Messages With Buttons (Quick Reply, URL, Phone Number, Copy Code)

For URL and Phone Number buttons, they do not need to be included in the response.

Description:

A basic template message without dynamic parameters.

Endpoint:

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

Method:

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": "marketing_all_buttons",
        "language": {
            "code": "en_us"
        },
        "components": [
            {
                "type": "header",
                "parameters": [
                    {
                        "type": "text",
                        "text": "Hi user"
                    }
                ]
            },
            {
                "type": "body",
                "parameters": [
                    {
                        "type": "text",
                        "text": "Our"
                    },
                    {
                        "type": "text",
                        "text": "whatsapp message app"
                    }
                ]
            },
            {
                "type": "button",
                "sub_type": "quick_reply",
                "index": 0,
                "parameters": [
                    {
                        "type": "text",
                        "text": "Unsubscribe from Promos"
                    }
                ]
            },
             {
                "type": "button",
                "sub_type": "copy_code", 
                "index": 1,
                "parameters": [
                    {
                        "type": "text",
                        "text": "WRETTT" 
                    }
                ]
            }
        ]
    }
}

Key Points in the Payload

Components:

  • Header: Includes an image URL.
  • Body: Contains text with placeholders replaced by dynamic values.
  • Footer: Simple static text.
  • Buttons: Supports two types of buttons:
    • QUICK_REPLY: For quick interactions.
    • URL: Redirects to a specific URL.

Parameters:

  • The parameters inside the header and body match the placeholders defined in the template.

URL Requirements:

  • The URL in the buttons section must be publicly accessible.

Template Approval:

  • Templates (e.g., marketing_all_buutons) must be pre-approved.

Response Structure

A successful request will return an HTTP status code of 200 OK along with the following response structure:

{
"messaging_product": "whatsapp",
"contacts": [
{
"input": "91xxxxxxxxxx",
"wa_id": "91xxxxxxxxxx",
"status_id": "MTA0NDI3"
}
],
"messages": [
{
"id": "kfGlB7LpVI",
"message_status": "accepted"
}
]
}

Field Descriptions

messaging_product:

  • Type: String
  • Description: Indicates the messaging platform. Always returns "whatsapp" for messages sent via the WhatsApp Business API.

contacts:

  • Type: Array
  • Description: Contains information about the message recipient(s).

Fields:

  • input:
    • Type: String
    • Description: The phone number input used in the API request (e.g., 91xxxxxxxxxx).
  • wa_id:
    • Type: String
    • Description: The WhatsApp ID associated with the input phone number.
  • status_id:
    • Type: String
    • Description: A unique identifier for the status of the message.

messages:

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

Fields:

  • id:
    • Type: String
    • Description: A unique identifier for the message sent (e.g., "M2s4da2y4P").
  • message_status:
    • Type: String
    • Description: The status of the message at the time of the response. Example values include:
      • “accepted” – The message was successfully accepted by the system.

Sample codes

Leave a Comment

Share this Doc

Message with parameters,header ,body ,footer and with buttons

Or copy link

CONTENTS