arazzo: 1.0.1 info: title: WhatsApp Find Approved Template and Send summary: Look up an approved message template by name and send it to a recipient. description: >- Template messages are the only way to open a conversation with a WhatsApp user outside the 24 hour customer service window. This workflow lists the message templates on a WhatsApp Business Account filtered to APPROVED status and a specific name, branches on whether a usable template was found, and when one exists sends a template message referencing it. Every step spells out its request inline so the flow can be read and executed without opening the underlying OpenAPI description. version: 1.0.0 sourceDescriptions: - name: whatsappBusinessManagementApi url: ../openapi/whatsapp-business-management-api-openapi.yml type: openapi - name: whatsappCloudApi url: ../openapi/whatsapp-cloud-api-openapi.yml type: openapi workflows: - workflowId: send-template-message summary: Resolve an approved template by name and deliver it as a template message. description: >- Lists APPROVED templates filtered by name and language on the WhatsApp Business Account, and only when a matching template is found sends a template message to the recipient referencing that template's name and language. inputs: type: object required: - accessToken - wabaId - phoneNumberId - to - templateName - language properties: accessToken: type: string description: Access token with whatsapp_business_management and whatsapp_business_messaging permissions. wabaId: type: string description: The WhatsApp Business Account ID that owns the templates. phoneNumberId: type: string description: The WhatsApp phone number ID that sends the message. to: type: string description: Recipient phone number in E.164 format without the leading plus. templateName: type: string description: The exact template name to look up and send. language: type: string description: The template language/locale code (e.g. en_US). steps: - stepId: findTemplate description: >- List templates on the WABA filtered to the supplied name, language, and APPROVED status so only a usable template is matched. operationId: listMessageTemplates parameters: - name: Authorization in: header value: Bearer $inputs.accessToken - name: waba-id in: path value: $inputs.wabaId - name: name in: query value: $inputs.templateName - name: language in: query value: $inputs.language - name: status in: query value: APPROVED successCriteria: - condition: $statusCode == 200 outputs: matchedTemplateName: $response.body#/data/0/name matchedTemplateStatus: $response.body#/data/0/status onSuccess: - name: templateFound type: goto stepId: sendTemplate criteria: - context: $response.body condition: $.data.length > 0 type: jsonpath - name: templateMissing type: end criteria: - context: $response.body condition: $.data.length == 0 type: jsonpath - stepId: sendTemplate description: >- Send a template message to the recipient referencing the approved template by name and language. operationId: sendMessage parameters: - name: Authorization in: header value: Bearer $inputs.accessToken - name: phone-number-id in: path value: $inputs.phoneNumberId requestBody: contentType: application/json payload: messaging_product: whatsapp recipient_type: individual to: $inputs.to type: template template: name: $steps.findTemplate.outputs.matchedTemplateName language: code: $inputs.language successCriteria: - condition: $statusCode == 200 outputs: messageId: $response.body#/messages/0/id outputs: matchedTemplateName: $steps.findTemplate.outputs.matchedTemplateName messageId: $steps.sendTemplate.outputs.messageId