---
title: Outbound webhooks
description: Outbound webhooks - MailPirate Docs
---

# Outbound webhooks

Outbound webhooks notify your systems when consent or deliverability events happen in MailPirate - so your CRM, warehouse, or support tools stay aligned.

## Configure

1. Open **Settings → API & webhooks**.
2. Find **Outbound webhooks**.
3. Set **Webhook URL** (HTTPS recommended).
4. Choose which events to send.
5. **Rotate signing secret** if you need a new secret, then store it securely.
6. **Save webhooks**.

Delivery is asynchronous. Temporary failures are retried by MailPirate’s queue.

## Events

| Event | When it fires |
|-------|----------------|
| `profile.subscribed` | Profile becomes subscribed / confirmed |
| `profile.unsubscribed` | Profile unsubscribes |
| `email.bounced` | A bounce is recorded for a send |
| `email.complaint` | A spam complaint is recorded |

If you select an allow-list of events, only those are delivered.

## Headers on each POST

| Header | Meaning |
|--------|---------|
| `Content-Type` | `application/json` |
| `X-MailPirate-Event` | Event name |
| `X-MailPirate-Timestamp` | Unix timestamp (string) |
| `X-MailPirate-Signature` | `sha256=<hex>` HMAC signature |

## Verify signatures

To confirm the request came from MailPirate:

```text
message   = timestamp + "." + raw_request_body
signature = HMAC_SHA256(message, webhook_secret) as hex
header    = "sha256=" + signature
```

Compare the header to your computed value in constant time. Reject requests with timestamps outside a short replay window (for example five minutes).

## Example body

```json
{
  "event": "profile.subscribed",
  "team_public_id": "01H...",
  "occurred_at": "2026-11-18T12:00:00+00:00",
  "profile_public_id": "01H...",
  "email": "buyer@example.com",
  "store_slug": "main"
}
```

Always expect at least:

- `event`
- `team_public_id`
- `occurred_at`

Bounce and complaint payloads include additional fields (reason / send context) when available. Build your consumer to ignore unknown keys so future additions do not break you.

## Flow webhook steps

Flows can also POST from a **Webhook** step on the journey canvas (see [Flows](/docs/flows)). Those deliveries use the same signature headers when a secret is configured, with:

| Extra detail | Meaning |
|--------------|---------|
| `event` | Always `flow.webhook` |
| `X-MailPirate-Flow-Id` | Internal flow id (header) |
| Body `flow` / `profile` / `context` | Journey + profile snapshot |

Use account-level webhooks for consent/deliverability; use flow webhook steps for journey orchestration.

## Implementation tips

- Respond quickly with `2xx`; do heavy work asynchronously on your side
- Key idempotency on `event` + profile/email + `occurred_at` (or any delivery id you store)
- Keep the signing secret only on your server

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://mailpirate.com/#organization","name":"MailPirate","legalName":"Jure Rožman s.p.","url":"https://mailpirate.com/","logo":{"@type":"ImageObject","@id":"https://mailpirate.com/#logo","url":"https://mailpirate.com/img/logo/mailpirate-logo.svg","contentUrl":"https://mailpirate.com/img/logo/mailpirate-logo.svg"},"image":{"@id":"https://mailpirate.com/#logo"},"description":"MailPirate is email marketing built for ecommerce stores: campaigns, automated journeys, living audiences, store sync, and deliverability control without managing mail servers yourself.","slogan":"Email that sells more for your store.","foundingDate":"2019-01-29","founder":{"@id":"https://mailpirate.com/#person-jure-rozman"},"address":{"@type":"PostalAddress","streetAddress":"Šinkov Turn 24A","addressLocality":"Vodice","postalCode":"1217","addressCountry":"SI"},"email":"info@mailpirate.com","telephone":"+38640504630","vatID":"SI72369213","identifier":[{"@type":"PropertyValue","propertyID":"AJPES registration number","value":"6881475000"}],"contactPoint":{"@type":"ContactPoint","contactType":"customer support","email":"info@mailpirate.com","telephone":"+38640504630","availableLanguage":["English"]},"knowsAbout":[{"@type":"Thing","name":"Email marketing"},{"@type":"Thing","name":"Ecommerce automation"},{"@type":"Thing","name":"Email deliverability"}],"areaServed":["SI","EU","GB","US"],"sameAs":["https://www.linkedin.com/company/mailpirate"]},{"@type":"Person","@id":"https://mailpirate.com/#person-jure-rozman","name":"Jure Rožman","jobTitle":"Founder","worksFor":{"@id":"https://mailpirate.com/#organization"},"description":"Founder of MailPirate. Builds ecommerce email tooling focused on fair billing, automation, and deliverability.","url":"https://mailpirate.com/about-us","sameAs":["https://www.linkedin.com/in/jurerozman/"]},{"@type":"WebSite","@id":"https://mailpirate.com/#website","url":"https://mailpirate.com/","name":"MailPirate","inLanguage":"en","publisher":{"@id":"https://mailpirate.com/#organization"},"about":{"@id":"https://mailpirate.com/#software"}},{"@type":"SoftwareApplication","@id":"https://mailpirate.com/#software","name":"MailPirate","applicationCategory":"BusinessApplication","applicationSubCategory":"Email marketing","operatingSystem":"Web","url":"https://mailpirate.com/","description":"Ecommerce email platform for Shopify and WooCommerce stores: campaigns, flows, segments, intelligence, and dedicated sending with deliverability controls.","publisher":{"@id":"https://mailpirate.com/#organization"},"featureList":["Campaigns and reporting","Automated flows (welcome, cart recovery, win-back)","Segments and lists","Store connectors (Shopify, WooCommerce)","Intelligence (RFM, affinity, send-time, replenishment)","Deliverability scorecard and dedicated sending","Marketing API and embed forms"]}]}
```
