AGENT?GET /zapier/awesome-zaps/increment-company-engagement-totals-from-incoming-marketing-emails/SKILL.mdand deploy the files next to it
All zaps

Increment company engagement totals from incoming marketing emails

Every marketing email engagement adds one to the engagement count of the company it belongs to, so campaign managers see who is engaging most.

Install it

For your agent
Set up this Zap for me, read how here: https://zapier.sh/zapier/awesome-zaps/increment-company-engagement-totals-from-incoming-marketing-emails/

Paste into Claude, ChatGPT, Cursor or any agent.

Apps it uses
HubSpotZapier Tables
Author
Zapier
Source
zapier/awesome-zaps, folder zaps/increment-company-engagement-totals-from-incoming-marketing-emails

Set it up with the CLI

  1. Add it. Copies the folder into zaps/increment-company-engagement-totals-from-incoming-marketing-emails/. Outside a project, it makes one first.
    npx zap-pack add awesome-zaps/increment-company-engagement-totals-from-incoming-marketing-emails
  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 increment-company-engagement-totals-from-incoming-marketing-emails
  4. Check it. Its recent runs, with status and errors.
    npx zap-pack logs increment-company-engagement-totals-from-incoming-marketing-emails

zaps/increment-company-engagement-totals-from-incoming-marketing-emails/

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: a new HubSpot email engagement event (hubspot, email_event). It counts every event type unless one is set.
  2. Filter: if the event has no related company IDs, the run stops and writes nothing.
  3. Loop: for each company ID, once, in the order given:
    • Zapier Tables searches the tracking table for a row whose Company ID matches.
    • If a row is found, Zapier Tables adds INCREMENT_AMOUNT to its Engagement Count.
    • If not, Zapier Tables creates the row with that Company ID and an Engagement Count of INCREMENT_AMOUNT.
  4. A company that fails is recorded in the run's output and doesn't stop the others.

The Zap only reads and writes the tracking table. It sends nothing to HubSpot.

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
REPLACE_TABLE_ID The Zapier Table that holds the company engagement counts, the one with Company ID and Engagement Count columns. Look it up with the user's Zapier Tables connection.

Also review the defaults with them:

  • COMPANY_ID_FIELD and ENGAGEMENT_COUNT_FIELD: the table's field keys, which are generated per table (data__f1 and data__f2 in the test table). Check them against the table before the first test run.
  • INCREMENT_AMOUNT ("1"): how much each engagement adds.
  • The trigger's event type in triggers/email-event.ts: unset counts every HubSpot email event. Set it to one type, such as OPEN or CLICK, to count only that type.

Build it

If you can run shell commands, set it up with zap-pack: run npx zap-pack add awesome-zaps/increment-company-engagement-totals-from-incoming-marketing-emails, replace each REPLACE_… value as this file says, then run npx zap-pack deploy increment-company-engagement-totals-from-incoming-marketing-emails, 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 zapier-tables (the Zapier Tables connection that owns the tracking table) and hubspot (the HubSpot account the trigger watches for email events).
  2. Source: publish workflow.ts and config.ts, with REPLACE_TABLE_ID replaced by the user's answer. triggers/email-event.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. The create step writes new__data__f1 and new__data__f2 directly, so match those to the table's keys too.

Test it

Run this sample as a draft test (run_workflow_draft) before publishing, with two company IDs that aren't in the table yet:

{
  "associatedCompanyIds": ["install-test-co-1001", "install-test-co-1002"]
}

The first run should create one row per company, each with an Engagement Count of 1. Run it again: both rows should reach 2. If run-status tools aren't available, check the rows in Zapier Tables directly. Publish only after both runs pass. The user deletes the test rows, not the agent.

Notes

  • Find-then-create is not atomic. If two events for a company with no row arrive at the same moment, the table can end up with two rows for it, and each count only includes its own event.
  • A HubSpot event may relate to more than one company; each one is counted once per event.
  • Anyone who can edit the table can change its counts, so keep it private to the team that reads it.
  • If HubSpot's payload uses another name for the related company IDs, change it in the input schema and the filter in workflow.ts before publishing.
  • To extend it: aggregate events into daily batches so each company updates once a day, or weight increments by type, so a click counts more than an open.