Update deal opt-in status from incoming webhook payloads
When a consent signal arrives, the matching Pipedrive deal's consent field is set to opt-in or opt-out, so sales sees current consent on the deal.
Install it
Set up this Zap for me, read how here: https://zapier.sh/zapier/awesome-zaps/update-deal-opt-in-status-from-incoming-webhook-payloads/
Paste into Claude, ChatGPT, Cursor or any agent.
- Category
- Legal · Privacy compliance
- Author
- Zapier
- Source
- zapier/awesome-zaps, folder zaps/update-deal-opt-in-status-from-incoming-webhook-payloads
Set it up with the CLI
- Add it. Copies the folder into
zaps/update-deal-opt-in-status-from-incoming-webhook-payloads/. Outside a project, it makes one first.npx zap-pack add awesome-zaps/update-deal-opt-in-status-from-incoming-webhook-payloads - Fill in the values in
config.ts, and in any other file the list marks. Replace each one as its comment and SKILL.md say. - Deploy it. Asks for any value still left, signs you in to Zapier if you aren't, then publishes it to your account.
npx zap-pack deploy update-deal-opt-in-status-from-incoming-webhook-payloads - Check it. Its recent runs, with status and errors.
npx zap-pack logs update-deal-opt-in-status-from-incoming-webhook-payloads
zaps/update-deal-opt-in-status-from-incoming-webhook-payloads/
- README.mdWhat it does, for people
- SKILL.mdHow an agent sets it up: what to ask you, and how to test it
- config.tsIts settings 1 to fill in
- connections/pipedrive.tsThe
pipedriveaccount it uses - triggers/hook.tsWhat starts it:
webhookhook_v2 - workflow.tsThe code; each
ctx.stepis a step in the Zap
Agents: add --yes to any command so it never prompts. When it needs an answer only the user can give, it stops and names the flag that supplies it.
SKILL.md
View MarkdownWhat it does
- Trigger: a consent signal arrives at a Webhooks by Zapier catch hook (
webhook,hook_v2). A form, consent tool or script posts to it. - Validation: if the payload has no deal ID, the run stops and writes nothing. A missing opt-out flag counts as opt-in.
- Pipedrive (
pipedrive) looks up the deal by its ID. If there is no match, the run stops and does not create a deal. - Pipedrive sets the deal's consent field to
YESfor opt-in, orNOwhen the opt-out flag istrue.
The Zap changes only the consent field of the one matching deal.
Ask the user
Each REPLACE_… value is set per person. Resolve names to IDs with the user's own connections; don't ask them to paste an ID you can look up.
| Setting | What goes there |
|---|---|
CONSENT_FIELD_KEY |
The API key of the Pipedrive deal custom field that stores consent. Ask which field it is, then look up its key with their Pipedrive connection |
Also review the defaults with them: DEAL_ID_KEY ("deal_id") and OPT_OUT_KEY ("opt_out"), the payload keys that carry the deal ID and the opt-out flag, and OPT_IN_VALUE and OPT_OUT_VALUE ("YES" and "NO"), the values the consent field takes. Change the keys if their sender uses other names.
Confirm that a missing opt-out flag should count as opt-in, as this Zap assumes, or whether the run should stop instead.
Build it
If you can run shell commands, set it up with zap-pack: run npx zap-pack add awesome-zaps/update-deal-opt-in-status-from-incoming-webhook-payloads, replace each REPLACE_… value as this file says, then run npx zap-pack deploy update-deal-opt-in-status-from-incoming-webhook-payloads, which signs the user in to Zapier when it gets there. Otherwise build with Zapier MCP, as the steps below say. No Zapier MCP tools? Read https://docs.zapier.com/mcp/get-started/quickstart.md and follow the page for the app you are running in to get the user connected, then continue with this build.
- Accounts: bind
pipedriveto the user's Pipedrive connection for the account that owns the deals. The Webhooks by Zapier catch hook needs no connection. - Source: publish
workflow.tsandconfig.ts, with eachREPLACE_…replaced by the user's answer.triggers/hook.tsandconnections/are settings, not code: set the workflow's trigger and connection bindings from them. The trigger file names the app by its slug; for the trigger'sselected_api, callsearch_triggerswith that slug, find the row whosekeyis the trigger'sevent, and use<app_key>@<app_version>from it. - Build guide: load Zapier's build guide with
get_zapier_skill("zapier:build-workflows")and follow it to create, test and publish the workflow. - Fields: inspect each action's fields with the user's connection and sample the trigger before the first test run, and fix any key in
workflow.tsthat doesn't match. Once it is published, give the user the webhook URL to point their consent system at.
Test it
Run it once as a draft test run, using a deal created for the test in a test Pipedrive account and named "[install-test] …":
{
"deal_id": "123",
"opt_out": true
}
Check that only that deal changed and its consent field reads NO. Then send an opt-in payload ("opt_out": false) and check that the field reads YES. If run-status tools aren't available, check the deal in Pipedrive directly. Then publish, confirm the trigger is active, and ask the user to delete the test deal.
Notes
- Duplicate payloads are not filtered. Each delivery writes the deal again.
- If the deal ID is not found, Pipedrive may return an error rather than an empty result, so the run fails rather than skips.
- Never commit a real Pipedrive field key or webhook URL. Anyone with the webhook URL can change consent on deals.
- To extend it: create a placeholder deal or contact when no deal matches the incoming ID, or add a Pipedrive note or activity on each consent change so reps see the context.