Add WhatsApp template

POST https://chatapps.8x8.com/api/v1/accounts/:accountId/channels/:channelId/templates

This endpoint is used to register new WhatsApp message template.

Please note that special html entities should be unescaped.

WhatsApp Message Templates are message formats for common reusable messages a business may want to send. Businesses must use Message Templates for sending notifications to customers. Any message sent outside the 24h customer service window, needs to be a template message, to be delivered. Advertising, marketing, or promotional messages are not permitted.

Request

Path Parameters

    accountId stringrequired

    Possible values: >= 32 characters and <= 36 characters, Value must match regular expression ^[0-9A-Fa-f]{8}[-]?(?:[0-9A-Fa-f]{4}[-]?){3}[0-9A-Fa-f]{12}$

    You must replace {accountId} with the accountid that you want to use.

    channelId stringrequired

    Channel identifier

Body

    languagestringrequired

    Template language code

    Example: en_US
    namestringrequired

    Template name

    Example: ticket_update_en_US
    categorystringrequired

    Template category.

    Templates containing a VOICE_CALL button are only allowed in MARKETING or UTILITY categories.

    Example: UTILITY

    components object[]required

    Registered template components

  • Array [
  • typestringrequired

    Component type

    Possible values: [HEADER, BODY, FOOTER, BUTTONS, CAROUSEL, CALL_PERMISSION_REQUEST]

    Default value: BODY
    formatstring

    Component type. Required for HEADER component type.
    Note: Gifs are currently only available for Marketing Messages API for WhatsApp.

    Possible values: [Text, Image, Gif, Video, Document, Location]

    Example: Image
    textstring

    Component text. Required for BODY and FOOTER types

    Example: You can pickup your delivery at {{1}}

    buttons object[]

  • Array [
  • typestringrequired

    Button type

    Possible values: [PHONE_NUMBER, URL, QUICK_REPLY, OTP, COPY_CODE, FLOW, VOICE_CALL]

    textstringrequired

    The text to be displayed on the button (except VOICE_CALL, where it is optional).

    Possible values: non-empty and <= 20 characters

    phoneNumberstring

    Required for type "PHONE_NUMBER".

    The phone number that will be called on clicking the button.

    countrystring

    Optional country code of phone number (ISO 3166-1 alpha-2). Required if the phone number in the national format.

    Possible values: >= 2 characters and <= 2 characters

    Example: US
    urlstring<uri>

    Required for type "URL".

    The URL that will be visited on clicking the button Variables can be used to create dynamic links.

    Example: https://website.com/{{1}}
    examplestring[]

    To help WhatsApp moderators during the review and approval process, you can include example data. This can help WhatsApp understand what kind of message you plan to send and showcase the customer experience.

    For example, you could include an image that could represent a customer's profile picture to personalize the experience.

    Make sure these are examples and do not include any confidential or personal information.

    flowIdstring

    Required for type "FLOW".

    The ID of the WhatsApp Flow to launch when the button is clicked.

    Example: 859504979861628
    flowActionstring

    Optional for type "FLOW".

    The action to perform when launching the flow. Defaults to "navigate" if not provided.

    Possible values: [navigate, data_exchange]

    Default value: navigate
    Example: navigate
    navigateScreenstring

    Optional for type "FLOW".

    The screen ID to navigate to when launching the flow. Used when flowAction is "navigate". Defaults to "FIRST_ENTRY_SCREEN" if not provided.

    Default value: FIRST_ENTRY_SCREEN
    Example: RECOMMEND
    ttlMinutesinteger

    Optional property for type "VOICE_CALL" only.

    The time-to-live in minutes for the voice call button. If provided, must be between 1440 mins (1 day) and 43200 mins (30 days), inclusive.

    Possible values: >= 1440 and <= 43200

    Example: 1440
  • ]
  • examplesstring[]

    To help WhatsApp moderators during the review and approval process, you can include example data. This can help WhatsApp understand what kind of message you plan to send and showcase the customer experience.

    For example, you could include an image that could represent a customer's profile picture to personalize the experience.

    Make sure these are examples and do not include any confidential or personal information.

    add_security_recommendationboolean

    Only for BODY component with AUTHENTICATION template category

    code_expiration_minutesinteger

    Only for FOOTER component with AUTHENTICATION template category

    Default value: 5

    cards object[]

    Required only for CAROUSEL type. You can create up to 10 cards.

  • Array [
  • typestringrequired

    Component type

    Possible values: [HEADER, BODY, BUTTONS]

    Default value: BODY
    formatstring

    Component type. Required for HEADER component type.

    Possible values: [Image, Video]

    Example: Image
    textstring

    Component text. Required for BODY and FOOTER types

    Example: You can pickup your delivery at {{1}}

    buttons object[]

  • Array [
  • typestringrequired

    Button type

    Possible values: [PHONE_NUMBER, URL, QUICK_REPLY, OTP, COPY_CODE]

    textstringrequired

    The text to be displayed on the button.

    Possible values: non-empty and <= 20 characters

    phoneNumberstring

    Required for type "PHONE_NUMBER".

    The phone number that will be called on clicking the button.

    countrystring

    Optional country code of phone number (ISO 3166-1 alpha-2). Required if the phone number in the national format.

    Possible values: >= 2 characters and <= 2 characters

    Example: US
    urlstring<uri>

    Required for type "URL".

    The URL that will be visited on clicking the button Variables can be used to create dynamic links.

    Example: https://website.com/{{1}}
    examplestring[]

    To help WhatsApp moderators during the review and approval process, you can include example data. This can help WhatsApp understand what kind of message you plan to send and showcase the customer experience.

    For example, you could include an image that could represent a customer's profile picture to personalize the experience.

    Make sure these are examples and do not include any confidential or personal information.

  • ]
  • examplesstring[]

    To help WhatsApp moderators during the review and approval process, you can include example data. This can help WhatsApp understand what kind of message you plan to send and showcase the customer experience.

    For example, you could include an image that could represent a customer's profile picture to personalize the experience.

    Make sure these are examples and do not include any confidential or personal information.

  • ]
  • ]
  • allow_category_changeboolean

    set to true to allow whatsapp to automatically assign a category. If omitted, the template may be rejected due to mis-categorization.

    Default value: true
    Example: false
    message_send_ttl_secondsinteger

    Custom time-to-live (TTL) for message delivery in seconds. If a message cannot be delivered within this time, it will be dropped.
    Valid ranges: Authentication templates (30-900 seconds or -1 for 30 days), Utility templates (30-43200 seconds or -1 for 30 days), Marketing templates (43200-2592000 seconds).
    Default TTL: Authentication=10 minutes (600 seconds), Utility/Marketing=30 days.

    Example: 300

Schema

    object
{}

Bad request error response

Schema

    codeintegerrequired

    Error code

    messagestring

    Error description

    errorIdstring<uuid>required

    Unique id of error. You can use it as reference when sending enquiries to 8x8 support

    timestampstring<date-time>required

    Data and time of the error occurence

{
"code":1001,
"message":"Provided subAccountId doesn't belongs to your account",
"errorId":"91b106f0-c0da-4aba-a43a-7af9c5893a80",
"timestamp":"2017-04-19T02:31:19.4297387+00:00"
}
{
"code":1002,
"message":"Invalid MSISDN format (not E.164 international number)",
"errorId":"b4478860-b76c-e811-814e-022a35cc1c71",
"timestamp":"2018-08-04T09:25:40.9235752+00:00"
}

Request was not authenticated response

Schema

    codeintegerrequired

    Error code

    messagestring

    Error description

    errorIdstring<uuid>required

    Unique id of error. You can use it as reference when sending enquiries to 8x8 support

    timestampstring<date-time>required

    Data and time of the error occurence

{
"code":1001,
"message":"Provided subAccountId doesn't belongs to your account",
"errorId":"91b106f0-c0da-4aba-a43a-7af9c5893a80",
"timestamp":"2017-04-19T02:31:19.4297387+00:00"
}
{
"code":1200,
"message":"Request was not authenticated properly",
"errorId":"db9dced4-3534-4d86-9d18-6b448af0d621",
"timestamp":"2018-08-02T09:42:38.8988997+00:00"
}

Template name cannot be reused within 30 days of deletion

Schema

    codeintegerrequired

    Error code

    messagestring

    Error description

    errorIdstring<uuid>required

    Unique id of error. You can use it as reference when sending enquiries to 8x8 support

    timestampstring<date-time>required

    Data and time of the error occurence

{
"code":1001,
"message":"Provided subAccountId doesn't belongs to your account",
"errorId":"91b106f0-c0da-4aba-a43a-7af9c5893a80",
"timestamp":"2017-04-19T02:31:19.4297387+00:00"
}
{
"code":3060,
"message":"New Indonesian content can't be added while the existing Indonesian content is being deleted. Try again in 4 weeks or consider creating a new message template.",
"errorId":"a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"timestamp":"2024-02-16T10:30:00.00Z"
}

Internal server error

Schema

    codeintegerrequired

    Error code

    messagestring

    Error description

    errorIdstring<uuid>required

    Unique id of error. You can use it as reference when sending enquiries to 8x8 support

    timestampstring<date-time>required

    Data and time of the error occurence

{
"code":1001,
"message":"Provided subAccountId doesn't belongs to your account",
"errorId":"91b106f0-c0da-4aba-a43a-7af9c5893a80",
"timestamp":"2017-04-19T02:31:19.4297387+00:00"
}
{
"code":2000,
"message":"Internal server error",
"errorId":"db9dced4-3534-4d86-9d18-6b448af0d621",
"timestamp":"2018-07-02T09:42:38.8988997+00:00"
}

Source: https://developer.8x8.com/connect/reference/add-whatsapp-template · 8x8 CPaaS Developer Docs. Synced for support deflection.

Was this article helpful?
or
0 out of 0 found this helpful

0 Comments

Please sign in to leave a comment.

Didn't find what you were looking for?

Submit a request