# Template: commissions into Google Sheets

One row for every commission a partner earns, safe from formulas, with the webhook's signature checked first.

A template for Make or n8n that adds a row to a Google Sheet for every
commission a partner earns:

| Date | Partner | Amount | Currency | Status |
|---|---|---|---|---|
| 2026-10-27 | Jane | 12.50 | USD | pending |

## What it does

1. Bolt Claw sends `referral.commission.created`, with the program's,
   commission's, conversion's and partner's ids and nothing more. The template
   checks the delivery's signature and time first.
2. It reads that partner's commissions in the program, newest first
   (`GET /v1/referrals/programs/{id}/commissions?partner_id=...`), and takes the
   one the event names.
3. It adds one row: the day the commission was created, the partner's display
   name, the amount in the currency's own units (1250 cents is `12.50`; 1500 JPY
   is `1500`), the currency and the status.

A sale that matched two reward rules earns two commissions and sends two
events, so it adds two rows. The status is the one at that moment: commissions
start `pending` and move on as their hold passes; the sheet is a log, not a
mirror. A display name that starts like a formula (`=`, `+`, `-`, `@`) is
written with a leading apostrophe, so the sheet shows it and never runs it.

## Before you start

- A key with `referrals:read` only.
- A Google Sheet whose first row is `Date`, `Partner`, `Amount`, `Currency`,
  `Status`, on a tab named `Commissions` (or change the tab in the template).
- An endpoint in **Settings, Developers, Webhooks** for the event
  `referral.commission.created`, added once you have the template's address.
  Copy its signing secret: it is shown once.

## In Make

1. Download `https://boltclaw.ai/referrals/templates/make/commission-to-sheets.json` and import it (**...** menu, **Import
   Blueprint**).
2. In the first module, **Add** a webhook. Under **Show advanced settings**, set
   **Get request headers** and **JSON pass-through** to **Yes**. Copy its
   address and add it as the endpoint in Bolt Claw.
3. **Expected signature**: replace `PASTE_THE_ENDPOINT_SIGNING_SECRET` with the
   signing secret. Keep the quotes.
4. **Read the commission**: replace `bc_live_PASTE_YOUR_KEY` in the
   `Authorization` header.
5. **Add the row**: your Google connection, the spreadsheet and the tab. The
   columns are mapped by position, A to E.
6. Switch the scenario on.

## In n8n

1. Download `https://boltclaw.ai/referrals/templates/n8n/commission-to-sheets.json` and import it (**Import from File**).
2. **Verify signature**: put the signing secret in an n8n Variable
   `BOLTCLAW_WEBHOOK_SECRET`, or between the quotes at the top of the node.
3. **Read the commission**: a **Header Auth** credential, Name `Authorization`,
   Value `Bearer bc_live_...`.
4. **Add the row**: your Google credential, the sheet's address and the tab.
   The row's keys match the column names in the first row.
5. Publish the workflow and add the **Bolt Claw webhook** node's production
   address as the endpoint.

## Test it

- **The signature.** Press **Test** on the endpoint in **Settings, Developers,
  Webhooks**. The test event passes the signature check and stops at the event
  check: the secret is right, and no row is added.
- **A row.** Switch on **Also send test events** for the endpoint, then press
  **Send a test sale** on the program's **Setup** tab. Its sale earns a test
  commission for the program's **Test partner**, and a row appears with that
  name. **Clear test data** removes the commission from Bolt Claw, not the row
  from your sheet.

<!-- https://boltclaw.ai/docs/referral-template-commission-sheets as markdown. Generated from openapi.yaml; API version 1.22.0. -->
<!-- Every /docs page answers as markdown: add .md to its path, or send Accept: text/markdown. -->
