feat(template): add shared WhatsApp/Twilio message-template utilities#62
feat(template): add shared WhatsApp/Twilio message-template utilities#62devi-r wants to merge 6 commits into
Conversation
Move the message-template logic (filtering, normalizing, validation, preview rendering and send-payload building) into the shared package so both web and mobile can consume a single implementation. Adds extractFilenameFromUrl to url.ts.
size-limit report 📦
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a87213f7dc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3adb35fa17
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3a3d8e7871
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…twoot/utils into feat/whatsapp-template-utils
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fb01553e25
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 347cd5fdb8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (hasVariables && processedParams.body) { | ||
| const hasEmptyBodyVariable = Object.keys(processedParams.body).some( | ||
| key => !processedParams.body?.[key] | ||
| ); | ||
| if (hasEmptyBodyVariable) return false; |
There was a problem hiding this comment.
Validate required body variables from the template
When callers pass an existing or partial processed_params object instead of the exact scaffold from buildWhatsAppProcessedParams, this checks only the body keys that are already present. For a template like Hi {{1}} {{2}}, { body: { '1': 'Sam' } } has no empty provided keys and is treated as complete, so the composer can send the template without the required {{2}} value; validate against the variables extracted from the template body instead.
Useful? React with 👍 / 👎.
Move the message-template logic (filtering, normalizing, validation, preview rendering and send-payload building) into the shared package so both web and mobile can consume a single implementation. Adds extractFilenameFromUrl to url.ts.