> For the complete documentation index, see [llms.txt](https://kasplo.gitbook.io/kasplo-doc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kasplo.gitbook.io/kasplo-doc/channels/transactional-api-smtp/webhooks.md).

# Webhooks

### Webhooks

Kasplo supports Webhooks to help you stay in sync with your email delivery lifecycle. Whether you’re sending emails via API or SMTP, the webhook mechanism remains the same and allows you to receive real-time HTTP POST callbacks for various events related to your outbound emails.This lets you:

* Monitor email delivery performance
* Capture user interactions like opens and clicks
* Maintain clean and up-to-date subscriber lists
* Analyze bounce patterns and deliverability trends

### Webhook Configuration

To receive webhook events, configure your webhook endpoint in your Kasplo dashboard. We recommend:

* Supporting HTTPS for security
* Responding with HTTP 200 status within 5 seconds
* Handling retries (in case your endpoint is temporarily unavailable)

Kasplo retries failed webhook deliveries with exponential backoff.

### Supported Webhook Events

Here are the webhook events we currently support:

1\. `delivery_attempt` : Represents an attempt to deliver the email to the recipient. Includes detailed results like success, failure, deferral, etc.

2\. `open` : Triggered when a recipient opens the email (based on tracking pixel).

3\. `click` : Triggered when a recipient clicks a tracked link in the email.

4\. `bounce_all` : Fired for every bounce received by the system. It does not mean the recipient should be removed. This event exists primarily for statistical/logging purposes. It includes the bounce type:

* `h` = hard bounce
* `s` = soft bounce
* `o` = other

5\. `bounce_bad_address` : Triggered when the recipient address should no longer be sent to. This typically occurs after the system determines the address is invalid based on repeated bounces. Bounce type is also included  (`h` or`s` ).

6\. `Unsubscribe` : Triggered when the recipient unsubscribes by clicking the unsubscribe link. This helps ensure compliance and maintain healthy list hygiene..

Kasplo provides two ways to manage unsubscribe links in your email templates, depending on whether you want unsubscribe clicks to be tracked or left untouched.

**Tracked unsubscribe link**

Add `Unsubscribe` placeholder in your email template to enable tracking.

Non-Tracked unsubscribe link

If you wish to use a custom unsubscribe URL that should not be replaced or tracked by Kasplo, include the following literal token in the URL:

`##UNSUB-LINK##`

7\. `spam_complaint` : Triggered when the recipient marks the email as spam. This is critical for maintaining sender reputation.

Each webhook event will include structured JSON data and metadata such as recipient, campaign ID, message ID, and timestamp.

In the next section, we’ll go deeper into each event type with example payloads so you can easily integrate them into your workflow.
