WhatsApp · Arazzo Workflow

WhatsApp Find and Update Message Template

Version 1.0.0

Locate a template by name and edit its body, when it is in an editable state.

1 workflow 1 source API 1 provider
View Spec View on GitHub ArazzoWorkflows

Provider

whatsapp

Workflows

update-template
Resolve an editable template by name and update its body text.
Lists templates filtered by name to find a matching template ID, and only when the matched template is APPROVED submits an update to its BODY component.
2 steps inputs: accessToken, newBodyText, templateName, wabaId outputs: templateId, updated
1
findTemplate
listMessageTemplates
List templates filtered by name to resolve the template ID and current status.
2
editTemplate
updateMessageTemplate
Submit an update to the matched template's BODY component; the edit re-triggers Meta's approval process.

Source API Descriptions

Arazzo Workflow Specification

whatsapp-update-template-workflow.yml Raw ↑
arazzo: 1.0.1
info:
  title: WhatsApp Find and Update Message Template
  summary: Locate a template by name and edit its body, when it is in an editable state.
  description: >-
    Only APPROVED or PAUSED templates can be edited, and edits re-trigger Meta's
    approval process. This workflow lists templates on a WhatsApp Business
    Account filtered by name, branches on whether the matched template is in an
    editable status, and when it is submits an update to its BODY component
    against the template ID. 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
workflows:
- workflowId: update-template
  summary: Resolve an editable template by name and update its body text.
  description: >-
    Lists templates filtered by name to find a matching template ID, and only
    when the matched template is APPROVED submits an update to its BODY
    component.
  inputs:
    type: object
    required:
    - accessToken
    - wabaId
    - templateName
    - newBodyText
    properties:
      accessToken:
        type: string
        description: Access token with whatsapp_business_management permission.
      wabaId:
        type: string
        description: The WhatsApp Business Account ID that owns the template.
      templateName:
        type: string
        description: The template name to look up and update.
      newBodyText:
        type: string
        description: The new BODY component text for the template.
  steps:
  - stepId: findTemplate
    description: >-
      List templates filtered by name to resolve the template ID and current
      status.
    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
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      templateId: $response.body#/data/0/id
      templateStatus: $response.body#/data/0/status
    onSuccess:
    - name: templateEditable
      type: goto
      stepId: editTemplate
      criteria:
      - context: $response.body
        condition: $.data[0].status == "APPROVED"
        type: jsonpath
    - name: templateNotEditable
      type: end
      criteria:
      - context: $response.body
        condition: $.data[0].status != "APPROVED"
        type: jsonpath
  - stepId: editTemplate
    description: >-
      Submit an update to the matched template's BODY component; the edit
      re-triggers Meta's approval process.
    operationId: updateMessageTemplate
    parameters:
    - name: Authorization
      in: header
      value: Bearer $inputs.accessToken
    - name: message-template-id
      in: path
      value: $steps.findTemplate.outputs.templateId
    requestBody:
      contentType: application/json
      payload:
        components:
        - type: BODY
          text: $inputs.newBodyText
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      success: $response.body#/success
  outputs:
    templateId: $steps.findTemplate.outputs.templateId
    updated: $steps.editTemplate.outputs.success