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

No parameter body , footer and button quick-replay , visit-website , phone-number and copy-code

Estimated reading: 3 minutes 73 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, BODY, FOOTER, BUTTONS).
  • format (string, required for HEADER type): Specifies the format of the header (e.g., TEXT).
  • text (string, required for HEADER, BODY, FOOTER): The actual content of the template component.
  • buttons (array, required for BUTTONS type): List of interactive buttons.

Buttons

Each button in the buttons array should have the following properties:

  • type (string, required): Type of button (e.g., QUICK_REPLY, URL, PHONE_NUMBER, COPY_CODE).
  • text (string, required for QUICK_REPLY, URL, PHONE_NUMBER types): The label displayed on the button.
  • url (string, required for URL type): The destination URL when the button is clicked.
  • phone_number (string, required for PHONE_NUMBER type): The phone number associated with the button.
  • example (string, required for COPY_CODE type): The example code to be copied when the button is pressed.

Sample Request

{
  "name": "markting_o",
  "language": "en_US",
  "category": "MARKETING",
  "allow_category_change": true,
  "components": [
        {
        "type": "BODY",
        "text": "Hi Greetings from P2C!"
        },
        {
        "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": "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.
  • The BODY component contains the main message text.
  • The FOOTER component is an optional text field that typically contains closing remarks.
  • The BUTTONS component allows adding interactive buttons, such as QUICK_REPLY, URL, PHONE_NUMBER, and COPY_CODE buttons for user interaction.

Leave a Comment

Share this Doc

No parameter body , footer and button quick-replay , visit-website , phone-number and copy-code

Or copy link

CONTENTS