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 69 views

PingtoChat’s Utility 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)

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

Endpoint:

POST 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.

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_ab",
        "language": {
            "code": "en_us"
        },
        "components": [
            {
                "type": "header",
                "parameters": [
                    {
                        "type": "text",
                        "text": "p2c"
                    }
                ]
            },
            {
                "type": "body",
                "parameters": [
                    {
                        "type": "text",
                        "text": "12CR007"
                    }
                ]
            },
            {
                "type": "button",
                "sub_type": "quick_reply",
                "index": 0,
                "parameters": [
                    {
                        "type": "text",
                        "text": "Unsubscribe from Promos"
                    }
                ]
            }
        ]
    }
}

Key Components

1. Header

  • Type: Text
  • Content: "p2c"
  • Purpose: Displays a short heading or key identifier.

2. Body

  • Type: Text
  • Content: "12CR007"
  • Purpose: Contains the main message content.

3. Buttons

  • Type: Quick Reply
  • Text: "Unsubscribe from Promos"
  • Purpose: Allows users to quickly opt out of promotional messages.

Response Structure

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

{
    "messaging_product": "whatsapp",
    "contacts": [
        {
            "input": "91xxxxxxxxxx",
            "wa_id": "91xxxxxxxxxx",
            "status_id": "MTA0NDI4"
        }
    ],
    "messages": [
        {
            "id": "8Eb8pQg0Xl",
            "message_status": "accepted"
        }
    ]
}

Field Descriptions

messaging_product

  • Type: String
  • Description: Indicates the messaging platform. Always returns "whatsapp".

contacts

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

Fields:

  • input:
    • Type: String
    • Description: The phone number used in the API request.
  • wa_id:
    • Type: String
    • Description: The WhatsApp ID associated with the 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.
  • message_status:
    • Type: String
    • Description: The status of the message at the time of the response. Example values include:
    • "accepted" – The message was successfully processed.

Sample codes

Leave a Comment

Share this Doc

Message with parameters header body footer and with buttons

Or copy link

CONTENTS