Skip to content

feat(chat): verify approval clicks server-side - #1096

Merged
bensabic merged 1 commit into
mainfrom
b/approval-callback-receipts
Oct 27, 2026
Merged

bensabic merged 1 commit into
mainfrom
b/approval-callback-receipts

Conversation

@bensabic

Copy link
Copy Markdown
Collaborator

requestApproval() now takes the decision and the deciding user from a record Chat SDK stores when it handles the click, instead of from the request that reaches the workflow webhook.

When Chat forwards a button click, it stores a receipt in the state adapter built from the platform's verified event, and adds the receipt's ID to the callback payload as receipt. requestApproval() reads the decision and user from that receipt, including for the approvers check, and ignores requests without one. If the receipt can't be stored, Chat skips the POST and restores the button so the user can click again. Callback URL errors now log only the origin.

This also fixes a bug with approvers. A click from someone outside the list used up that button's single-use callback, so approvers couldn't click it afterwards. The card now gets fresh buttons after that click.

requestApproval() now needs a thread created by Chat SDK, and a state adapter shared by the instance that handles clicks and the one that runs the workflow. Every callbackUrl click writes a receipt that expires after 24 hours.

When Chat forwards a button click to a callback URL, it now stores a
receipt in the state adapter built from the platform's verified event
and adds the receipt's ID to the payload. requestApproval() reads the
decision and user from that receipt and ignores requests without one.

After a click from someone outside approvers, the approval card gets
fresh buttons so approvers can still decide. If the receipt can't be
stored, Chat skips the POST and restores the button's callback token.
Callback URL errors now log only the origin.

Signed-off-by: Ben Sabic <bensabic@users.noreply.github.com>
@bensabic
bensabic requested a review from a team October 27, 2026 11:35
@vercel

vercel Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
chat Ready Ready Preview, v0 Oct 27, 2026 11:36am UTC

@bensabic
bensabic disabled auto-merge October 27, 2026 14:40
@bensabic
bensabic merged commit b8b6f0f into main Oct 27, 2026
25 checks passed
@bensabic
bensabic deleted the b/approval-callback-receipts branch October 27, 2026 14:40

This branch was successfully deployed

1 active deployment
Preview — 924f991f Deployed Oct 27, 2026 by vercel[bot]
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