Articles on: API Documentation

Setting Up and Using Webhooks via the Super Send API

Setting Up and Using Webhooks via the Super Send API

Super Send’s API allows you to integrate webhooks for real-time notifications about events like opens, clicks, replies, and bounces. This guide explains how to set up and manage webhooks effectively.



1. What Are Webhooks?



Webhooks enable Super Send to send event data directly to your application in real-time. They are triggered whenever specific events occur, such as:

Email Opens
Link Clicks
Replies Received
Email Bounces



2. Setting Up a Webhook



To create a webhook, make a POST request to the webhooks endpoint.

Example Request:



curl -X POST https://api.supersend.io/v1/webhooks \
-H "Authorization: Bearer <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
  "url": "https://yourapp.com/webhook-endpoint",
  "events": ["open", "click", "reply", "bounce"],
  "TeamId": "your-team-id"
}'


Required Fields:



url: The endpoint URL where Super Send will send event data.
events: An array of event types to track (e.g., open, click, reply, bounce).
TeamId: The team associated with the webhook.



3. Testing a Webhook



Once a webhook is created, test it to ensure it’s configured correctly.

Example Request:



curl -X POST https://api.supersend.io/v1/webhooks/<WEBHOOK_ID>/test \
-H "Authorization: Bearer <YOUR_API_KEY>"


Super Send will send a test payload to your webhook URL. Verify that your application receives and processes the data correctly.



4. Managing Webhooks



Retrieve All Webhooks:



curl -X GET https://api.supersend.io/v1/webhooks \
-H "Authorization: Bearer <YOUR_API_KEY>"


Retrieve a Specific Webhook:



curl -X GET https://api.supersend.io/v1/webhooks/<WEBHOOK_ID> \
-H "Authorization: Bearer <YOUR_API_KEY>"


Update a Webhook:



To modify a webhook, use the PUT method with the webhook’s unique ID.

curl -X PUT https://api.supersend.io/v1/webhooks/<WEBHOOK_ID> \
-H "Authorization: Bearer <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
  "url": "https://newurl.com/webhook-endpoint",
  "events": ["open", "click"]
}'


Delete a Webhook:



To delete a webhook, send a DELETE request to the webhook’s endpoint.

curl -X DELETE https://api.supersend.io/v1/webhooks/<WEBHOOK_ID> \
-H "Authorization: Bearer <YOUR_API_KEY>"




5. Webhook Payload Structure



Each webhook payload includes the following fields:

{
  "event": "open",
  "timestamp": "2025-01-22T10:00:00Z",
  "CampaignId": "campaign-id",
  "ContactId": "contact-id",
  "details": {
    "email": "example@example.com",
    "ip_address": "192.168.1.1"
  }
}


Field Descriptions:



event: The event type (e.g., open, click).
timestamp: When the event occurred.
CampaignId: The associated campaign.
ContactId: The contact tied to the event.
details: Additional data about the event.



6. Best Practices for Using Webhooks



Secure Your Endpoint:
Use HTTPS to encrypt data in transit.
Validate incoming requests to ensure they originate from Super Send.

Log Events:
Maintain logs of webhook events for troubleshooting and auditing.

Handle Retries Gracefully:
Implement retry logic in your application to handle potential webhook delivery delays or failures.

Monitor Performance:
Regularly review webhook performance and address any bottlenecks or errors


By setting up and managing webhooks through the Super Send API, you can gain real-time insights into your campaigns and respond to events immediately, enhancing the efficiency and effectiveness of your outreach.

Updated on: 22/01/2025

Was this article helpful?

Share your feedback

Cancel

Thank you!