Le traduzioni sono generate tramite traduzione automatica. In caso di conflitto tra il contenuto di una traduzione e la versione originale in Inglese, quest'ultima prevarrà.
Creazione di modelli di messaggi con l' CreateWhatsAppMessageTemplate API
Puoi creare modelli di WhatsApp messaggi personalizzati utilizzando l'API End User Messaging Social. Questo argomento descrive come utilizzare il CreateWhatsAppMessageTemplateper creare una varietà di modelli di WhatsApp messaggio.
Componenti del modello di messaggio
WhatsApp i modelli di messaggio possono includere i seguenti componenti:
Intestazione: testo del titolo visualizzato in alto
Corpo: contenuto principale del messaggio con segnaposti variabili
Piè di pagina: informazioni aggiuntive in basso
Pulsanti: elementi cliccabili che rimandano a URLs
Negli esempi seguenti sostituisci ENDPOINT
e WABA_ID
con l'URL dell'endpoint e l'ID dell'account WhatsApp aziendale effettivi.
Crea un modello di utilità di base in inglese
Questo esempio crea un modello di messaggio di utilità in inglese che utilizza solo il BODY
componente e non include HEADER
o BUTTON
componenti. FOOTER
Il corpo del testo utilizza segnaposto variabili.
$
aws social-messaging create-whats-app-message-template --region
us-east-1
--endpoint-urlENDPOINT_URL
\ --idWABA_ID
\ --template-definition '{ "name": "order_update_basic", "language": "en_US", "allow_category_change": true, "category": "UTILITY", "components": [ { "type": "BODY", "text": "Hi {{1}}, your order #{{2}} has been shipped. Track your delivery below." } ] }'
Crea un modello di utilità in inglese di base con pulsante
Questo esempio crea un modello di messaggio di utilità in inglese che include BODY
e BUTTON
componenti.
$
aws social-messaging create-whats-app-message-template --region
us-east-1
--endpoint-urlENDPOINT_URL
\ --idWABA_ID
\ --template-definition '{ "name": "order_update_with_button", "language": "en_US", "allow_category_change": true, "category": "UTILITY", "components": [ { "type": "BODY", "text": "Hi {{1}}, your order #{{2}} has been shipped. Track your delivery below." }, { "type": "BUTTONS", "buttons": [ { "type": "URL", "text": "Track Order", "url": "https://example.com/track" } ] } ] }'
Crea un modello di messaggio di utilità in inglese complesso con un'intestazione, un corpo e un pulsante
Questo esempio crea un modello di messaggio di utilità in inglese che include HEADER
e BUTTON
componenti. BODY
$
aws social-messaging create-whats-app-message-template --region
us-east-1
--endpoint-urlENDPOINT_URL
\ --idWABA_ID
\ --template-definition '{ "name": "account_creation_confirmation_3333", "category": "UTILITY", "language": "en_US", "status": "APPROVED", "components": [ { "type": "HEADER", "format": "TEXT", "text": "Finalize account set-up" }, { "type": "BODY", "text": "Hi {{1}},\n\nYour new account has been created successfully. \n\nPlease verify {{2}} to complete your profile.", "example": { "body_text": [ [ "John", "your email address" ] ] } }, { "type": "BUTTONS", "buttons": [ { "type": "URL", "text": "Verify account", "url": "https://www.example.com/" } ] } ] }'
Crea un modello di messaggio di marketing di base
Questo esempio crea un modello di messaggio di marketing di base che include solo un BODY
componente.
$
aws social-messaging create-whats-app-message-template --region us-east-1 --endpoint-url
ENDPOINT_URL
\ --idWABA_ID
\ --template-definition '{ "id": "1290345849293233", "name": "holiday_special_1395238", "category": "MARKETING", "language": "en_US", "status": "PENDING", "components": [ { "type": "BODY", "text": "Season's Greetings {{1}}!\n\nCelebrate {{2}} with amazing deals up to {{3}} off.\n\nPlus, get free gift wrapping on all orders above $50.", "example": { "body_text": [ [ "Pawan", "Christmas", "30%" ] ] } } ], "metaTemplateId": "1290345849293233" }'
Crea un modello di messaggio di marketing complesso
Questo esempio crea un modello di messaggio di marketing in inglese che include HEADER
e BUTTON
componenti. BODY
$
aws social-messaging create-whats-app-message-template --region us-east-1 \ --endpoint-url
ENDPOINT_URL
\ --idWABA_ID
\ --template-definition '{ "name": "summer_sale_1", "category": "MARKETING", "language": "en_US", "status": "APPROVED", "components": [ { "type": "HEADER", "format": "TEXT", "text": "Summer Sale!" }, { "type": "BODY", "text": "Hi {{1}}! Get {{2}} off all summer items. Shop now before stock runs out!" }, { "type": "FOOTER", "text": "Valid until August 31st" }, { "type": "BUTTONS", "buttons": [ { "type": "URL", "text": "Shop Now", "url": "https://example.com/sale" } ] } ] }'