Blocks Documentation
This documentation provides an overview of the different blocks that can be added to a channel template for the WhatsApp platform. Each block serves a specific purpose and can be customized to create rich and interactive conversations with users. The following blocks are available:
Text
Header, Body, or Footer Blocks
Role:
header
,body
, orfooter
Purpose: Displays text content in the header, body, or footer section of the message.
Properties:
text
: Specifies the text to be displayed. The maximum length varies depending on the role.
Images
Header Block
Role:
header
Purpose: Displays an image in the header section of the message.
Properties:
mediaUrl
: The URL of the image to be displayed.altText
: Alternative text to be shown if the image cannot be loaded.
Files
Header Block
Role:
header
Purpose: Displays a file attachment in the header section of the message.
Properties:
mediaUrl
: The URL of the file to be attached.contentType
: The type of file, such as PDF, JPEG, PNG, or MP4.filename
: The name of the file.altText
: Alternative text to be shown if the file cannot be loaded.
Authentication body block
Purpose: Specifically used for the authentication message type to provide users with their code and information around code expiration.
Properties:
addSecurityDisclaimer
: Specifies whether to include a security disclaimer.expirationTime
: The expiration time for the authentication process in days (1-90). Optional.
Actions
Link Action Block
Purpose: Displays a text message with a link that users can interact with.
Properties:
text
: The text to be displayed as the message content.url
: The URL to which the link should navigate.
Reply Action Block
Purpose: Displays a text message with a reply option for users.
Properties:
text
: The text to be displayed as the message content.payload
: An optional payload to be sent back when the reply option is selected.imageUrl
: An optional image URL to be displayed alongside the text.
Authentication Action Block
Purpose: Displays a button that users can click to copy the authentication code.
Properties:
copyAuthenticationCodeText
: The text to be displayed for copying the authentication code.oneTap
: An optional object representing the one-tap authentication configuration. IncludesoneTapText
,androidPackageName
, andandroidSignatureHash
properties. Read more here.
Message types and block structures
There are 4 main message types supported by WhatsApp Approved templates. Each message type is made up of a block structure:
Text message
Must contain text body (only 1 is allowed)
Can contain only 1 text footer
Can contain only 1 of the following headers: text | image | file header
Can contain only 1 link action. Cannot be combined with reply actions.
Can contain up to 3 reply actions. Cannot be combined with a link action.
Image message
Must contain text body (only 1 is allowed)
Can contain only 1 image
Can contain only 1 text footer
Can contain only 1 link action. Cannot be combined with reply actions.
Can contain up to 3 reply actions. Cannot be combined with a link action.
File message
Must contain text body (only 1 is allowed)
Can contain only 1 file
Can contain only 1 text footer
Can contain only 1 link action. Cannot be combined with reply actions.
Can contain up to 3 reply actions. Cannot be combined with a link action.
Authentication message
Must contain an authentication body
Must contain an authentication action
Block IDs
Here are some guidelines and considerations regarding the IDs for blocks:
Uniqueness: Each block should have a unique ID within the conversation. This ensures that no two blocks have the same identifier, avoiding conflicts or ambiguity.
ID Format: IDs can be alphanumeric strings, often generated using unique identifiers, such as UUIDs (Universally Unique Identifiers). These IDs should be sufficiently long and complex to minimize the chance of collision.
ID Assignment: IDs can be assigned during the initial creation of the block.
In the example above, the block has an ID of "cbA0XdmkFDAbJiGfS41kK9"
. This ID serves as a unique identifier for the block within the conversation. Other blocks in the conversation would have their own unique IDs.
Last updated