---
title: Zapier
description: Fire a heartbeat from any Zap using the Webhooks by Zapier action.
section: integrations
order: 5
---

# Zapier

The Webhooks by Zapier action fires an AgentPing heartbeat as the last step of any Zap.

## Setup

Add a **Webhooks by Zapier** action.

Simple success ping:

- **Event**: `GET`
- **URL**: `https://eu.ingest.agentping.io/v1/ping`
- **Query string params**:
  - `key`: per-agent `ping_` token
  - `agent`: agent slug
  - `status`: `ok`

Richer payload (cost, metadata, timestamps):

- **Event**: `POST`
- **URL**: `https://eu.ingest.agentping.io/v1/heartbeats`
- **Payload Type**: `JSON`
- **Data**:
  ```json
  {
    "agent": "support-triage",
    "status": "ok",
    "cost_usd": 0.084,
    "metadata": {
      "zap_id": "<zap_id_from_trigger>",
      "items_processed": "<count_from_previous_step>"
    }
  }
  ```
- **Headers**: `Authorization: Bearer ping_eu_018f3a2b9c1d7e8fa4b9c2d7e8f1a3b6`

Pipe values from previous steps with Zapier's variable picker. The Zap history view shows each request and response.

## Credentials

Paste the per-agent `ping_` token directly into the URL (`GET`) or Authorization header (`POST`). Zapier redacts it after save.

Never use an `apk_` API key in a Zap. A leaked Zap config or shared template compromises your entire team. See [Authentication](/docs/api/auth).

## Failure paths

Zapier doesn't expose a clean "this Zap failed" branch by default. Two patterns:

- **Filter + Paths**: a Paths step after your main action. Success path fires `status=ok`, failure path fires `status=fail`. Branch on whatever the upstream step produces.
- **Zap error webhook**: Zapier's error-notification webhook, pointed at AgentPing. Catches Zap-level failures (timeouts, missing fields, disconnects) rather than business-logic failures.

## Cost attribution

OpenAI or Anthropic via Zapier's native integrations expose `prompt_tokens` and `completion_tokens`. Two options:

- Compute cost in a **Formatter by Zapier** step (tokens × per-million rate) and pass `cost_usd` in the heartbeat.
- Send raw token counts as `metadata`; the rate card prices them server-side if the model is on the card.

:::note
Zapier has no built-in "this Zap stopped firing" alert. Set the trigger frequency as the agent's expected schedule and [Pulse](/docs/pulse) pages you when a run is overdue.
:::
