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

Message without parameters, attachments, and with buttons

Estimated reading: 4 minutes 77 views

Description:

Send a template message with dynamic text parameters and an image attachment in the header.

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.

Example:

{
  "messaging_product": "whatsapp",
  "recipient_type": "individual",
  "to": "91xxxxxxxxxx",
  "type": "template",
  "template": {
    "name": "marketing_buttons",
    "language": {
      "code": "en"
    },
    "components": [
        {
        "type":"BUTTONS",
        "buttons": [
            {
            "type": "QUICK_REPLY",
            "text": "Unsubscribe from Promos"
            },
        
            {
            "type": "url",
            "text": "Go to link",
            "url": "https://developers.pingtochat.com/"
        
            }
        
        
        ]
        }
    ]
  }
}

Field Descriptions

  1. messaging_product
    • Description: Indicates the messaging product being used.
    • Value: "whatsapp" (since this message is for WhatsApp).
  2. recipient_type
    • Description: Specifies the type of recipient.
    • Value: "individual" (indicates the message is intended for an individual user).
  3. to
    • Description: The recipient’s WhatsApp phone number in international format.
    • Value: "91xxxxxxxxxx" (replace xxxxxxxxxx with the actual phone number).
  4. type
    • Description: Specifies the type of message being sent.
    • Value: "template" (indicates this is a template message).
  5. template
    • Description: The main object containing template message details.
    • Fields:
      • name:
        • Description: The name of the message template.
        • Value: "marketing_buttons" (name of the pre-approved template on WhatsApp).
      • language:
        • code:
          • Description: The language code for the message.
          • Value: "en" (English).
      • components:
        • Description: An array of objects specifying dynamic content for the template.
  6. components
    • Description: Holds the dynamic elements of the template.
    • Fields:
      • type:
        • Description: The type of dynamic element in the template.
        • Value: "BUTTONS" (indicates buttons will be included in the message).
      • buttons:
        • Description: An array of button objects within the template.
  7. buttons
    • Description: Defines individual buttons within the template.
    • Fields:
      1. type:
        • Description: The type of button.
        • Value:
          • "QUICK_REPLY": A button that sends a predefined reply when clicked.
          • "url": A button that redirects the user to a specified URL.
      2. text:
        • Description: The text displayed on the button.
        • Value:
          • "Unsubscribe from Promos": Text for the quick reply button.
          • "Go to link": Text for the URL button.
      3. url (for url buttons only):
        • Description: The URL the button redirects to.
        • Value: "https://developers.pingtochat.com/".

Response

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": "NTg0MTc="
    }
  ],
  "messages": [
    {
      "id": "M2s4da2y4P",
      "message_status": "accepted"
    }
  ]
}

Field Descriptions

  1. messaging_product:
    • Type: String
    • Description: Indicates the messaging platform. Always returns whatsapp for messages sent via the WhatsApp Business API.
  2. 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.
  3. messages:
    • Type: Array
    • Description: Contains details about the seMessages Without Buttonsnt 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 without parameters, attachments, and with buttons

Or copy link

CONTENTS