Pingtochat Docs

Pingtochat Docs

Did You Know?

We design Docy for the readers, optimizing not for page views or engagement

leafleafleafDocy banner shape 01Docy banner shape 02Man illustrationFlower illustration

Parameter with header-image body footer and buttons – quick-replay,visit-website,phone-number,copy-code

Estimated reading: 3 minutes 88 views

The Template Creation API allows users to create marketing templates that can be used for various communication purposes. Each template consists of a name, language, category, and content components, such as body text, headers, footers, and interactive buttons.

Endpoint

http://{{your_domain}}/api/v1.0/{{phone_number_id}}/{{key}}/message_templates
  • {{your_domain}}: Your domain URL where the API is hosted.
  • {{phone_number_id}}: The unique identifier of the phone number used for sending messages.
  • {{key}}: Your API key for authentication.How to create key

Request Headers

  • Authorization: Bearer token for authentication.
  • Content-Type: Should be set to application/json.

Request Body Parameters

  • name (string, required): Unique identifier for the template.
  • language (string, required): Language code in ISO 639-1 format (e.g., en_US).
  • category (string, required): Template category, such as MARKETING.
  • allow_category_change (boolean, required): Determines if the category can be changed after creation.
  • components (array, required): List of template components.

Components

Each component in the components array should have the following properties:

  • type (string, required): Type of component (e.g., HEADER, BODY, FOOTER, BUTTONS).
  • text (string, required for BODY and FOOTER): The actual content of the template component.
  • format (string, required for HEADER when media is used): The format type (e.g., MEDIA).
  • example (object, required for HEADER with media, BODY with placeholders, and copy_code button): Example data such as media URL, placeholder values, or promo code.
  • buttons (array, required for BUTTONS component): List of interactive buttons.
    • type (string, required): Type of button (e.g., QUICK_REPLY, URL, PHONE_NUMBER, COPY_CODE).
    • text (string, required for QUICK_REPLY, URL, PHONE_NUMBER): The button label text.
    • url (string, required for URL button): The destination link.
    • phone_number (string, required for PHONE_NUMBER button): Contact number.
    • example (string, required for COPY_CODE button): Example promo code.

Request Body Examples

{
    "name": "marketing_parameter_attachment",
    "language": "en_US",
    "category": "MARKETING",
    "allow_category_change": true,
    "components": [
        {
            "type": "HEADER",
            "format": "MEDIA",
            "example": {
                "media_url": "https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png"
            }
        },
        {
            "type": "BODY",
            "text": "We are intraducing  {{1}} new product about {{2}}",
            "example": {
                "body_text": [
                    [
                        "our",
                        "whatsapp message app"
                    ]
                ]
            }
        },
        {
            "type": "FOOTER",
            "text": "Thank you for choosing us!"
        },
        {
            "type": "BUTTONS",
            "buttons": [
                {
                    "type": "QUICK_REPLY",
                    "text": "Unsubscribe from Promos"
                },
                {
                    "type": "url",
                    "text": "Go to link",
                    "url": "https://app.pingtochat.com/"
                },
                {
                    "type": "PHONE_NUMBER",
                    "text": "Call",
                    "phone_number": "919526986676"
                },
                {
                    "type": "copy_code",
                    "example": "WRETTT"
                }
            ]
        }
    ]
}

Success Response

Status Code: 201 APPROVED

{
    "id": "333137",
    "status": "APPROVED",
    "category": "MARKETING"
}

Notes

  • Ensure that the template name is unique across all templates.
  • The language field must follow ISO 639-1 format (e.g., en_US).
  • The API requires an authorization token for security.
  • If allow_category_change is set to false, the category cannot be modified later.
  • The HEADER component supports media attachments via a valid media URL.
  • The BODY component supports placeholders for dynamic content.
  • The BUTTONS component provides interactive elements such as quick replies, URLs, phone numbers, and copy codes for user engagement.

Leave a Comment

Share this Doc

Parameter with header-image body footer and buttons – quick-replay,visit-website,phone-number,copy-code

Or copy link

CONTENTS