Skip to content

CreateWhatsAppMessageTemplate

Source: src/AWS/SocialMessaging/CreateWhatsAppMessageTemplate.ts

Runtime binding for social-messaging:CreateWhatsAppMessageTemplate.

Creates a WhatsApp message template on the bound account from a raw Meta template-definition JSON blob. Templates must be approved by Meta before they can be sent.

The deploy-time half grants social-messaging:CreateWhatsAppMessageTemplate on the bound WABA’s ARN and the runtime half injects the linked account id into every request. Provide the implementation with Effect.provide(AWS.SocialMessaging.CreateWhatsAppMessageTemplateHttp).

// init — bind the operation to the linked WABA
const createTemplate = yield* AWS.SocialMessaging.CreateWhatsAppMessageTemplate(account);
// runtime
const { metaTemplateId, templateStatus } = yield* createTemplate({
templateDefinition: new TextEncoder().encode(
JSON.stringify({
name: "order_update",
language: "en_US",
category: "UTILITY",
components: [{ type: "BODY", text: "Your order {{1}} shipped." }],
}),
),
});