CreateWhatsAppMessageTemplate API を使用したメッセージテンプレートの作成 - AWS エンドユーザーメッセージングソーシャル

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

CreateWhatsAppMessageTemplate API を使用したメッセージテンプレートの作成

End User Messaging Social API を使用して、カスタマイズされた WhatsApp メッセージテンプレートを作成できます。このトピックでは、CreateWhatsAppMessageTemplate を使用してさまざまな WhatsApp メッセージテンプレートを作成する方法について説明します。

メッセージテンプレートコンポーネント

WhatsApp メッセージテンプレートには、次のコンポーネントを含めることができます。

  • ヘッダー: 上部に表示されるタイトルテキスト

  • 本文: 可変プレースホルダーを含むメインメッセージコンテンツ

  • フッター: 下部の追加情報

  • ボタン: URLs にリンクするクリック可能な要素

次の例では、ENDPOINTWABA_ID を実際のエンドポイント URL と WhatsApp Business Account ID に置き換えます。

基本的な英語ユーティリティテンプレートを作成する

この例では、 BODYコンポーネントのみを使用し、HEADER、、FOOTERまたは BUTTONコンポーネントを含まないユーティリティメッセージテンプレートを英語で作成します。本文テキストは可変プレースホルダーを使用します。

$ aws social-messaging create-whats-app-message-template --region us-east-1 --endpoint-url ENDPOINT_URL \ --id WABA_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." } ] }'

ボタンを使用して基本的な英語ユーティリティテンプレートを作成する

この例では、 BODY および BUTTONコンポーネントを含むユーティリティメッセージテンプレートを英語で作成します。

$ aws social-messaging create-whats-app-message-template --region us-east-1 --endpoint-url ENDPOINT_URL \ --id WABA_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" } ] } ] }'

ヘッダー、本文、ボタンを使用して複雑な英語ユーティリティメッセージテンプレートを作成する

この例では、HEADERBODYBUTTONコンポーネントを含むユーティリティメッセージテンプレートを英語で作成します。

$ aws social-messaging create-whats-app-message-template --region us-east-1 --endpoint-url ENDPOINT_URL \ --id WABA_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/" } ] } ] }'

基本的なマーケティングメッセージテンプレートを作成する

この例では、BODYコンポーネントのみを含む基本的なマーケティングメッセージテンプレートを作成します。

$ aws social-messaging create-whats-app-message-template --region us-east-1 --endpoint-url ENDPOINT_URL \ --id WABA_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" }'

複雑なマーケティングメッセージテンプレートを作成する

この例では、HEADERBODYBUTTONコンポーネントを含むマーケティングメッセージテンプレートを英語で作成します。

$ aws social-messaging create-whats-app-message-template --region us-east-1 \ --endpoint-url ENDPOINT_URL \ --id WABA_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" } ] } ] }'