Skip to content

fix(whatsapp): support text header parameters - #65

Merged
muhsin-k merged 2 commits into
mainfrom
codex/whatsapp-text-header-params
Jul 28, 2026
Merged

fix(whatsapp): support text header parameters#65
muhsin-k merged 2 commits into
mainfrom
codex/whatsapp-text-header-params

Conversation

@muhsin-k

Copy link
Copy Markdown
Member

WhatsApp templates can define variables independently in text headers and message bodies. The shared template utilities currently initialize and validate only body variables and media headers, so consumers cannot collect text-header values such as Welcome {{1}}.

This change adds text-header variables to the processed-parameter scaffold and completeness validation while preserving the existing media-header behavior. Positional variables remain component-scoped, producing structures such as header: { 1: value } alongside body: { 1: value, 2: value }.

How to test

  1. Build processed parameters for a template containing HEADER text Welcome {{1}} and a body containing {{1}} and {{2}}.
  2. Confirm the scaffold contains one header parameter and two body parameters.
  3. Confirm completeness remains false until all three values are filled.
  4. Confirm media-header templates continue producing their existing media fields.

@github-actions

Copy link
Copy Markdown

size-limit report 📦

Path Size
dist/utils.cjs.production.min.js 13.27 KB (+0.44% 🔺)
dist/utils.esm.js 12.67 KB (+0.47% 🔺)

@muhsin-k
muhsin-k marked this pull request as ready for review July 27, 2026 18:31

@iamsivin iamsivin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code LGTM

@muhsin-k
muhsin-k merged commit 360c23a into main Jul 28, 2026
7 checks passed
muhsin-k added a commit to chatwoot/chatwoot that referenced this pull request Jul 29, 2026
WhatsApp templates with variables in both a text header and body
currently show inputs only for the body. Agents therefore cannot provide
the header value in the template composer, even though the API and
backend support the corresponding `processed_params.header` payload.

The composer now displays text-header variables separately, previews
their substituted values, and sends them alongside body parameters.
Templates using media headers remain unchanged.

Related: chatwoot/utils#65

### Things to know

This PR consumes the released `@chatwoot/utils@0.0.57`, which adds
text-header parameter construction and completeness validation.

### How to reproduce

1. Open a WhatsApp template containing text header `Welcome {{1}}` and
body variables `{{1}}` and `{{2}}`.
2. Observe that the current composer displays only two body inputs and
omits the header input.

### How to test

1. Open the same template in the conversation composer.
2. Confirm one header input and two body inputs are displayed.
3. Fill the values and confirm both the header and body previews update.
4. Send the template and confirm `processed_params` contains `header.1`,
`body.1`, and `body.2`.

---------

Co-authored-by: Muhsin <12408980+muhsin-k@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants