AGENT?GET /zapier/awesome-zaps/post-one-time-codes-from-email-to-api-endpoint/SKILL.mdand deploy the files next to it
All zaps

Post one-time codes from email to an API endpoint

When a one-time code arrives by email, it is pulled out and sent straight to your verification endpoint, so provisioning finishes without anyone copying codes by hand.

Install it

For your agent
Set up this Zap for me, read how here: https://zapier.sh/zapier/awesome-zaps/post-one-time-codes-from-email-to-api-endpoint/

Paste into Claude, ChatGPT, Cursor or any agent.

Apps it uses
GmailWebhooks by Zapier
Author
Zapier
Source
zapier/awesome-zaps, folder zaps/post-one-time-codes-from-email-to-api-endpoint

Set it up with the CLI

  1. Add it. Copies the folder into zaps/post-one-time-codes-from-email-to-api-endpoint/. Outside a project, it makes one first.
    npx zap-pack add awesome-zaps/post-one-time-codes-from-email-to-api-endpoint
  2. 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.
  3. 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 post-one-time-codes-from-email-to-api-endpoint
  4. Check it. Its recent runs, with status and errors.
    npx zap-pack logs post-one-time-codes-from-email-to-api-endpoint

zaps/post-one-time-codes-from-email-to-api-endpoint/

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.

What it does

  1. Trigger: Gmail, New Email Matching Search (gmail, search), with a sender + subject search (query) for the vendor's code emails.
  2. Filter (code): continues only if the email is from the vendor's sender address or the body contains a code-like pattern. Anything else stops with skipped: not-a-code-email.
  3. Extract (code): finds the code in the plain-text body: first a number of 4–8 digits within 40 characters after "code", "passcode", "OTP" or "PIN"; otherwise any bare 6-digit number.
  4. Webhooks by Zapier (webhook) POSTs JSON to the endpoint: code, extraction (matched or failed), source_sender, source_subject, source_received_at. If no code was found, code is empty and the full plain-text body is sent instead. Gmail message and thread IDs are never sent.

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 Where What goes there
ENDPOINT_URL config.ts The verification endpoint's URL: the HTTPS address that accepts the code as a JSON POST
VENDOR_SENDER config.ts The vendor's sender address. Emails from it always pass the filter; others pass only if a code is found
REPLACE_GMAIL_SEARCH triggers/search.ts, params.query The Gmail search that finds the vendor's code emails, such as from:<sender> subject:"<subject>". Use the same sender as VENDOR_SENDER

Also review these with them:

  • The code is digits only, and MIN_CODE_LENGTH and MAX_CODE_LENGTH in workflow.ts (4 and 8) set its length. Alphanumeric codes need a different pattern.
  • Does the endpoint need auth headers, or different field names than code, source_sender, source_subject and source_received_at? If so, change the POST step before installing.

Build it

If you can run shell commands, set it up with zap-pack: run npx zap-pack add awesome-zaps/post-one-time-codes-from-email-to-api-endpoint, replace each REPLACE_… value as this file says, then run npx zap-pack deploy post-one-time-codes-from-email-to-api-endpoint, 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.

  1. Accounts: bind gmail (the Gmail account that receives the codes) to the user's Gmail connection. Only the trigger uses it; the workflow itself uses no connection alias. Webhooks by Zapier needs no connection.
  2. Source: publish workflow.ts and config.ts, with each REPLACE_… replaced by the user's answer. triggers/search.ts and connections/ 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's selected_api, call search_triggers with that slug, find the row whose key is the trigger's event, and use <app_key>@<app_version> from it.
  3. Build guide: load Zapier's build guide with get_zapier_skill("zapier:build-workflows") and follow it to create, test and publish the workflow.
  4. Fields: inspect each action's fields with the user's connections and sample the trigger before the first test run, and fix any key in workflow.ts that doesn't match.

Test it

Run it once as a draft test with ENDPOINT_URL set to an echo endpoint such as https://httpbin.org/post. Send an email to the connected Gmail account itself with a subject matching the trigger search, then sample the trigger and run this record:

{
  "message_id": "1a18…",
  "thread_id": "1a18…",
  "from": { "name": "", "email": "you@example.com" },
  "subject": "[install-test] Your verification code",
  "body_plain": "Hi,\n\nYour one-time verification code is: 482913\n\nThis code expires in 10 minutes. If you didn't request it, ignore this email.\n\n-- Install Test Vendor\r\n\r\n",
  "date": "Thu, 29 Oct 2026 16:52:16 -0700"
}

Check that the run output's response.json echoes code: "482913", extraction: "matched" and the sender, subject and date, and contains no message or thread ID. If run-status tools aren't available, check the result in the echo endpoint directly. Ask the user to delete the test email; the agent doesn't delete test data. Then set ENDPOINT_URL to the real endpoint, publish, and confirm the trigger is active.

Notes

  • Gmail's search also matches sent mail. Add in:inbox to the search to ignore it.
  • The bare 6-digit fallback can pick up other numbers (order IDs, dates such as 202610) in emails that pass the filter by sender alone. Keep the search narrow.
  • The POST step retries on failure, which can post the same code twice. Make the endpoint idempotent on the code.
  • Never commit a real endpoint URL. One-time codes are sensitive; send them only to an HTTPS endpoint you control.
  • To alert on failed extraction, send a team notification or create a ticket when extraction is failed. For high volume, queue codes instead of posting them directly to the endpoint.