WhatsApp-Objekt
Das Objekt
whats_appermöglicht es Ihnen, WhatsApp-Nachrichten über unsere Messaging-Endpunkte zu ändern oder zu erstellen.
WhatsApp-Objekt
{
"app_id": (required, string) see App Identifier,
"subscription_group_id": (required, string) the ID of your subscription group,
"message_variation_id": (optional, string) used when providing a campaign_id to specify which message variation this message should be tracked under,
"message_type": (required, string) the type of WhatsApp message being sent under the `message` key (template_message | text_response_message | text_image_response_message | quick_reply_response_message | list_response_message | flow_response_message | carousel_response_message),
"message": (required, object) The message object that must include the required fields based on the selected `message_type`. Below are the specific message structures for each type. Refer to the relevant message type for the required fields and their format.
}
Nachrichtentypen
template_message
{
"template_name": (required, string) the WhatsApp template name for the message,
"template_language_code": (required, string) the language code of the WhatsApp template for the message,
"header_variables": (optional, header variables object) an object to specify header variable values for specified template_name, required if the header has variables; see object specification below,
"body_variables": (optional, body variable object) an object to specify body variable values for specified template_name, required if the body has variables; see object specification below,
"button_variables": (optional, button variables object) an object to specify button variable values for specified template_name, required if buttons have variables; see object specification below,
"header_media_uri": (optional, string) URI to the header media, if the header is of type IMAGE in specified template_name. Only IMAGE and TEXT header types are supported by the messages/send API,
"carousel_cards": (optional, array) an array of carousel card objects, required if the specified template_name is a carousel template; see object specification below
}

Medienversand (Dokumente, Videos und andere Medientypen) wird von der messages/send-API nicht unterstützt. Nur die Header-Typen TEXT und IMAGE werden für Template-Nachrichten unterstützt, die über die API gesendet werden. Wenn Ihr WhatsApp-Template einen Header vom Typ DOCUMENT, VIDEO oder einem anderen Medientyp verwendet, können Sie es nicht über die messages/send-API senden. Verwenden Sie die Campaigns Triggered API oder das Braze-Dashboard, um Templates mit Medien-Headern zu senden. Dies gilt nur für den Hauptheader des Templates; Karussellkarten-Medien unterstützen sowohl Bilder als auch Videos.
Karussellkarten-Objekt
Jede Karussellkarte füllt eine Karte eines genehmigten Karussell-Templates, in der Reihenfolge. Die Karte am Index 0 füllt die erste Karte des Templates.
{
"header_media_uri": (required, string) URI to the card's header media; must be Braze-hosted media,
"header_media_type": (required, string) The type of the card's header media (image | video),
"body_variables": (optional, body variables object) Values for the card's body variables, in the same format as the template-level body_variables,
"button_variables": (optional, button variables object) Values for the card's button variables, in the same format as the template-level button_variables
}
Einschränkungen
carousel_cards: Muss zwischen 2 und 10 Karten enthalten, passend zur Kartenanzahl des genehmigten Templates.header_media_uri: Muss auf Medien verweisen, die in der Braze-Medienbibliothek gehostet werden.header_media_type: Alle Karten müssen denselben Medientyp verwenden, passend zum genehmigten Template.
Beispiel
{
"template_name": "weekly_picks",
"template_language_code": "en",
"body_variables": {
"0": "Jane"
},
"carousel_cards": [
{
"header_media_uri": "https://braze-images.com/card1.png",
"header_media_type": "image",
"body_variables": {
"0": "Runner X"
}
},
{
"header_media_uri": "https://braze-images.com/card2.png",
"header_media_type": "image",
"body_variables": {
"0": "Trail Pro"
},
"button_variables": {
"0": "/promo/123"
}
}
]
}
Header-Variablen-Objekt
Das header_variables-Objekt ermöglicht es Ihnen, Werte für Header-Variablen im WhatsApp-Template anzugeben. Jeder Schlüssel ist der WhatsApp-Template-Variablenindex (nullbasiert), der durch den angegebenen Wert ersetzt wird.

Sie können header_variables nur mit Templates verwenden, die Header vom Typ TEXT haben. Für IMAGE-Header verwenden Sie stattdessen header_media_uri. DOCUMENT-, VIDEO- und andere Medien-Header-Typen werden von der messages/send-API nicht unterstützt.
header_image_uri wird nur für Antwortnachrichtentypen (z. B. quick_reply_response_message) verwendet, nicht für Template-Nachrichten.
{
"$TEMPLATE_VARIABLE_INDEX_0": "$TEMPLATE_VARIABLE_VALUE_0"
}
Derzeit kann nur null oder eine Header-Variable angegeben werden.
Beispiel
{
"0": "Check it out!"
}
Body-Variablen-Objekt
Das body_variables-Objekt ermöglicht es Ihnen, Werte für Body-Variablen im WhatsApp-Template anzugeben. Jeder Schlüssel ist der WhatsApp-Template-Variablenindex (nullbasiert), der durch den angegebenen Wert ersetzt wird.
{
"$TEMPLATE_VARIABLE_INDEX_0": "$TEMPLATE_VARIABLE_VALUE_0",
"$TEMPLATE_VARIABLE_INDEX_1": "$TEMPLATE_VARIABLE_VALUE_1"
}
Beispiel
{
"0": "Check it out!",
"1": "It's pretty neat."
}
Button-Variablen-Objekt
Das button_variables-Objekt ermöglicht es Ihnen, Werte für Button-Variablen im WhatsApp-Template anzugeben. Jeder Schlüssel ist der WhatsApp-Template-Variablenindex (nullbasiert), der durch den angegebenen Wert ersetzt wird.
{
"$TEMPLATE_VARIABLE_INDEX_1": "$TEMPLATE_VARIABLE_VALUE_1"
}
Derzeit kann nur eine Button-Variable angegeben werden, nämlich die Pfadkomponente einer Call-to-Action-URL. Der Variablenindex muss mit dem CTA-URL-Button-Index im Template übereinstimmen. Wenn Ihr CTA-Button beispielsweise der zweite Button in Ihrem Template ist, verwenden Sie den Variablenindex „1“.
Beispiel
{
"1": "/marketing/promotion123"
}
Antwortnachrichten
text_response_message
{
"body": (required, string) the body of the message to send,
"preview_url": (optional, boolean) whether WhatsApp should render a preview of links included in body
}
Beispiel
{
"body": "Check out our new deals at https://braze.com",
"preview_url": true
}
text_image_response_message
{
"image_uri": (required, string) the uri of the image to send,
"caption": (optional, string) the caption for the image being sent
}
Beispiel
{
"image_uri": "https://braze.com/promotion.jpg",
"caption": "This won't last for long, check it out!"
}
quick_reply_response_message
{
"body": (required, string) the body of the message to send,
"header_image_uri": (optional, string) the URI of the image to send as the message header (only valid if header_text not present),
"header_text": (optional, string) the text to send as the message header (only valid if header_image_uri not present),
"footer": (optional, string) the footer of the message to send,
"buttons": (required, array) array of Button objects. Will render in message based on order in array.
}
Button-Objekt
{
"text": (required, string) the text of the button
}
Beispiel
{
"body": "Want to keep hearing from us?",
"buttons": [
{
"text": "Yes!"
},
{
"text": "No thanks"
}
]
}
list_response_message
Der Nachrichtentyp list_response_message ermöglicht es Ihnen, eine listenbasierte Nachricht in WhatsApp zu senden. Dieser Nachrichtentyp enthält eine Liste von Elementen, mit denen die Empfänger:innen interagieren können.
{
"header": (optional, string) the header of the message to send,
"body": (required, string) the body of the message to send,
"footer": (optional, string) the footer of the message to send,
"list": (required, object) the list object that contains:
"list_button_text": (required, string) the text that will appear on the list button,
"list_sections": (required, array) an array of List Section Objects
}
Listenabschnitt-Objekt
{
"section_title": (required, string) The title of the section,
"list_rows": (required, array) An array of List Row Objects
}
Listenzeilen-Objekt
{
"row_title": (required, string) The title of the row,
"row_description": (optional, string) The description for the row
}
Einschränkungen
list_sections: Muss mindestens einen Abschnitt enthalten.list_rows: Insgesamt können maximal 10 Zeilen über alle Abschnitte hinweg enthalten sein.row_description: Für jede Zeile optional.
Beispiel
{
"body": "Here is a list of options to choose from:",
"list": {
"list_button_text": "Choose an option",
"list_sections": [
{
"section_title": "Section 1",
"list_rows": [
{
"row_title": "Option 1"
},
{
"row_title": "Option 2",
"row_description": "Description for Option 2"
}
]
},
{
"section_title": "Section 2",
"list_rows": [
{
"row_title": "Option 3"
},
{
"row_title": "Option 4"
},
{
"row_title": "Option 5"
}
]
}
]
}
}
flow_response_message
Der Nachrichtentyp flow_response_message ermöglicht es Ihnen, eine flowbasierte Nachricht in WhatsApp zu senden. Dieser Nachrichtentyp enthält einen interaktiven Flow, den die Empfänger:innen ausfüllen können.
{
"header_text": (optional, string) the header text of the message to send,
"body": (required, string) the body of the message to send,
"footer": (optional, string) the footer of the message to send,
"flow_button": (required, object) the flow button object that contains:
"caption": (required, string) the text that will appear on the flow button,
"flow_id": (required, string) the unique identifier of the WhatsApp Flow,
"generate_custom_attribute": (optional, boolean) whether to save flow response on the user profile and generate a custom attribute upon responding to this flow message
}
Flow-Button-Objekt
{
"caption": (required, string) The text displayed on the button,
"flow_id": (required, string) The ID of the flow
}
Einschränkungen
flow_button: Muss sowohlcaptionals auchflow_identhalten.caption: Maximal 20 Zeichen.flow_id: Muss eine gültige, veröffentlichte Flow-ID sein.
Beispiel
{
"body": "Please complete your order details",
"flow_button": {
"caption": "Start Order",
"flow_id": "594425479261596"
},
"generate_custom_attribute": true
}
carousel_response_message
Der Nachrichtentyp carousel_response_message ermöglicht es Ihnen, ein interaktives Karussell aus Medienkarten als Antwortnachricht zu senden, durch die Nutzer:innen wischen können. Jede Karte enthält Medien, optionalen Textkörper und entweder Schnellantwort-Buttons oder einen Website-Button.
{
"body": (required, string) the body of the message to send,
"carousel_button_type": (required, string) the button type used by every card (quick_reply | url),
"cards": (required, array) an array of Card objects. Cards render in the carousel in array order.
}
Karten-Objekt
{
"media_uri": (required, string) the URI of the card's media,
"media_type": (required, string) the type of the card's media (image | video),
"body_text": (optional, string) the body text of the card,
"buttons": (required for quick_reply, array) an array of button label strings,
"cta_url_button": (required for url, object) the website button object that contains:
"display_text": (required, string) the text displayed on the button,
"url": (required, string) the URL the button opens
}
Einschränkungen
cards: Muss zwischen 2 und 10 Karten enthalten.media_type: Alle Karten müssen denselben Medientyp verwenden.body_text: Maximal 160 Zeichen pro Karte.buttons: Beiquick_replymuss jede Karte die gleiche Anzahl an Buttons haben, mit maximal zwei pro Karte.cta_url_button: Beiurlmuss jede Karte einencta_url_buttonenthalten.
Beispiel mit Schnellantwort-Buttons
{
"body": "Check out this week's picks!",
"carousel_button_type": "quick_reply",
"cards": [
{
"media_uri": "https://example.com/card1.png",
"media_type": "image",
"body_text": "Runner X - now 20% off",
"buttons": ["Shop now", "Not for me"]
},
{
"media_uri": "https://example.com/card2.png",
"media_type": "image",
"body_text": "Trail Pro - back in stock",
"buttons": ["Shop now", "Not for me"]
}
]
}
Beispiel mit Website-Buttons
{
"body": "Check out this week's picks!",
"carousel_button_type": "url",
"cards": [
{
"media_uri": "https://example.com/card1.png",
"media_type": "image",
"body_text": "Runner X - now 20% off",
"cta_url_button": {
"display_text": "Visit",
"url": "https://example.com/runner-x"
}
},
{
"media_uri": "https://example.com/card2.png",
"media_type": "image",
"body_text": "Trail Pro - back in stock",
"cta_url_button": {
"display_text": "Visit",
"url": "https://example.com/trail-pro"
}
}
]
}