Webhooks

A webhook sends a signed HTTP POST request to your endpoint when a campaign event happens, for example when an email is sent or a recipient submits data.

Overview

Where: Campaigns > Webhooks

The list shows all webhooks that can be used in campaigns. Click a name to edit it. The row menu has Update, Copy, Send test and Delete.

A webhook does nothing on its own. Add it to a campaign, see Use a webhook in a campaign.

Create new webhook

Click New webhook.

Webhook fields
Field Description
Name Name of the webhook, up to 127 characters
URL The endpoint that receives the requests. Must be a full http or https URL. Use https for anything outside your own network.
Secret Optional shared secret used to sign each request with HMAC SHA256, see Verifying webhooks

Send test

Choose Send test in the row menu to send a test request right away. The test uses the event name test, the campaign name Test Campaign and the email [email protected]. The Webhook test modal shows the request, the response status and the response body.

Use a webhook in a campaign

Where: campaign wizard > Miscellaneous > Show advanced options > Webhooks

Click + Add Webhook, pick the webhook under Endpoint, then choose the data level and events. A campaign can have several webhooks, each with its own settings. A program sets its webhooks the same way, in the advanced options of its Setup step.

Data Level
Level Fields sent
Minimum time and event
Basic time, event and campaignName
Full (default) time, event, campaignName, the recipient's email and, for events that capture data, data with the submitted values

Under Events, click an event to turn it on or off. All events are on by default and at least one must stay on. When every event is on, the webhook also receives events that have no toggle, such as campaign_recipient_reported.

For an anonymous campaign, events about a single recipient are never sent to webhooks, and Full is lowered to Basic. Campaign events such as campaign_closed are still sent.

Request Format

Each request is a POST with a JSON body. Requests are sent in the background and time out after 3 seconds. Example with the Full data level:

POST /api/webhook HTTP/1.1
Content-Type: application/json
User-Agent: Go-http-client
X-Signature: 3ec2d0d777495b4410331a8e22de309e393761ed2e16f4271577e812ffaf26e3

{
  "time": "2025-03-30T12:13:00.026471259Z",
  "campaignName": "Example",
  "email": "[email protected]",
  "event": "campaign_recipient_message_sent"
}

Events of a program use the same format and event types. At the Basic and Full data levels, campaignName holds the program name, and the body also holds programName and programId. An anonymous program sends no events of single recipients.

Event types

Webhook events
Event Name in the wizard Sent when
campaign_recipient_message_sent Message Sent The email was handed to the SMTP server or API
campaign_recipient_message_failed Message Failed Sending the email failed
campaign_recipient_message_read Message Read The tracking pixel in the email was loaded
campaign_recipient_submitted_data Submitted Data The recipient submitted data on a page
campaign_recipient_page_visited Page Visited The recipient opened the landing page
campaign_recipient_before_page_visited Before Page Visited The recipient opened the before landing page
campaign_recipient_after_page_visited After Page Visited The recipient opened the after landing page
campaign_recipient_evasion_page_visited Evasion Page Visited The evasion page was served
campaign_recipient_deny_page_visited Deny Page Visited The deny page was served
campaign_recipient_training_started Training Started The recipient opened an awareness training
campaign_recipient_training_completed Training Completed The recipient completed an awareness training
campaign_closed Campaign Closed The campaign was closed. Has no recipient email.

Verifying webhooks

When the webhook has a secret, the X-Signature header holds the HMAC SHA256 of the raw request body, keyed with the secret and hex encoded. Compute the same value on your side and compare it to the header to confirm the request came from Phishing Club and was not changed. When no secret is set, the header holds UNSIGNED.

Example in Go:

bodyBytes, err := io.ReadAll(req.Body)
if err != nil {
	http.Error(w, "failed to read body", http.StatusInternalServerError)
	return
}

h := hmac.New(sha256.New, []byte("YOUR_SECRET_HERE"))
h.Write(bodyBytes)
expected := hex.EncodeToString(h.Sum(nil))

signature := req.Header.Get("X-Signature")
if !hmac.Equal([]byte(expected), []byte(signature)) {
	http.Error(w, "invalid signature", http.StatusForbidden)
	return
}