Overview
This guide outlines the steps to set up a custom email connection via webhook in Castled. By configuring a webhook connection, Castled will make a REST API call to the provided URL with the email payload, enabling seamless integration with your email system.Implement Castled Webhook API
Castled will send a POST request to the configured webhook URL with the following payload:sourceContext will have additional information about the campaign/workflow being run, it can be null if sending in test mode.
Setup webhook connection.
Go to Settings > Channel > Email > Webhook in the Castled Dashboard.
Click on “Add Providers” and enter the necessary details:
- Email Name: A unique name to identify your connection.
- Webhook URL : The POST URL where Castled will send the email payload.
- Batch Size: Determines the number of email payloads sent in each batch.
Enable Custom Tracking(Optional)
Step 1: Add Custom Tracking Domain
For precise email tracking, Castled enhances the original email HTML with predefined hooks linked to Castled servers. However, using a separate click domain may marginally affect delivery rates. To overcome this, Castled offers the flexibility to set up a custom tracking domain, enabling requests to be routed through your domain to Castled Servers. Define a tracking subdomain (ideally a subdomain of the sender domain) and create a CNAME record pointing to Castled’s tracking domain,esp.castleddata.co.
Step 2: Enable Custom Tracking
In the webhook connection settings, enable custom tracking and enter the tracking domain.
Secure Link Tracking
If you enable custom tracking, the URL embedded in the email will be HTTP, which is generally adequate. However, if you prefer to use HTTPS urls instead, you’ll need to set up a secure tracking domain and configure it to proxy the requests to the Castled server and enable theSecure Link Tracking option in the connection.
Email Events Reporting Webhook
In addition to the events (opened, clicked) that are tracked by Castled using Custom Tracking, you could also report events related to email campaigns or
workflows using the following webhook.
unsubscribedbouncedfailedskippedcomplained