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

Template with header-image body and button quick replay

Estimated reading: 2 minutes 64 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 the body text.

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).
  • type (string, required): Type of component (e.g., BODY).
  • text (string, required): The actual content of the template component.
  • file (string, required):

Request Body

{
  "name": "marketing_attachment_one",
  "language": "en_US",
  "category": "MARKETING",
  "allow_category_change": true,
  "components": [
    {
            "type": "header",
            "parameters": [
                {
                    "type": "image",
                    "image": {
                        "link": "https://app.pingtochat.com/template_media/1736424548.png"
                    }
                }
            ]
        },
        {
        "type": "BODY",
        "text": "We are intraducing  {{1}} new product about {{2}}",
        "example": {
            "body_text": [
            [
                "our","whatsapp message app"
            ]
            ]
        }
        },
        {
        "type":"BUTTONS",
        "buttons": [
                {
                "type": "QUICK_REPLY",
                "text": "Unsubscribe from Promos"
                }
            ]
        }
    ]
}

Success Response

Status Code: 201 APPROVED

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

Notes

  • Ensure that the 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.

Leave a Comment

Share this Doc

Template with header-image body and button quick replay

Or copy link

CONTENTS