Overview
Webhooks (Web Callback, HTTP Push API, or Reverse API) are a method for one web application to transmit messages to the other application in real-time when a predefined event takes place. TagMango's webhooks allow you to receive information about specific events based on parameters of the event.
How Webhooks Work
When an event occurs (like a student reaching 50% course progress), TagMango sends an HTTP POST request to your configured webhook URL with the event data.
Getting Started
- Set up a webhook endpoint on your server
- Configure the webhook URL with the following register webhook api
- Handle the incoming webhook events in your application
Registering webhook
In order to register a webhook on TagMango follow the following steps:
- Retrieve your API Key from TagMango dashboard by going to Dashboard -> Platform Integrations (any of them will work).
- Use the key to hit the following api endpoint:
To subscribe to this webhook event, configure your webhook endpoint with the following:
- cURL
- JavaScript
- Python
curl -X 'POST' \
'https://api-prod-new.tagmango.com/api/v1/integration/webhook/webhook' \
-H 'accept: application/json' \
-H 'x-api-key: <Your API Key>' \
-H 'Content-Type: application/json' \
-d '{
"hookUrl": "<your webhook url>",
"event": "<webhook_event_type>",
"mango": "<mango to be associated> (optional sends all mango related events if not specified)",
"course": "<course to be associated> (optional sends all course related events if not specified)",
"webinar": "<webinar to be associated> (optional sends all webinar related events if not specified)",
"page": "<page to be associated> (optional sends all page related events if not specified)"
}'
fetch('https://api-prod-new.tagmango.com/api/v1/integration/webhook/webhook', {
method: 'POST',
headers: {
'accept': 'application/json',
'Content-Type': 'application/json',
'x-api-key': '<Your API Key>'
},
body: JSON.stringify({
"hookUrl": "<your webhook url>",
"event": "<webhook_event_type>",
"mango": "<mango to be associated> (optional sends all mango related events if not specified)",
"course": "<course to be associated> (optional sends all course related events if not specified)",
"webinar": "<webinar to be associated> (optional sends all webinar related events if not specified)",
"page": "<page to be associated> (optional sends all page related events if not specified)"
})
})
.then(response => response.json())
.then(data => console.log(data));
import requests
import json
url = "https://api-prod-new.tagmango.com/api/v1/integration/webhook/webhook"
headers = {
"accept": "application/json",
"Content-Type": "application/json",
"x-api-key": "<Your API Key>"
}
data = {
"hookUrl": "<your webhook url>",
"event": "<webhook_event_type>",
"mango": "<mango to be associated> (optional sends all mango related events if not specified)",
"course": "<course to be associated> (optional sends all course related events if not specified)",
"webinar": "<webinar to be associated> (optional sends all webinar related events if not specified)",
"page": "<page to be associated> (optional sends all page related events if not specified)"
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
hookUrl | string | Yes | Your webhook endpoint URL |
event | string | Yes | Must be `<webhook_event_type>` |
mango | string | No | Specific mango ID to monitor. If not specified, receives events for all mangoes |
course | string | No | Specific course ID to monitor. If not specified, receives events for all courses |
webinar | string | No | Specific webinar ID to monitor. If not specified, receives events for all webinars |
page | string | No | Specific page ID to monitor. If not specified, receives events for all pages |
Testing
You can test your webhook implementation using tools like:
- ngrok for local development
- webhook.site for testing
- Postman for manual testing
Delete Existing Webhook
To delete a webhook, use the following request:
- cURL
- JavaScript
- Python
curl -X 'DELETE' \
'https://api-prod-new.tagmango.com/api/v1/integration/webhook/webhook' \
-H 'accept: application/json' \
-H 'x-api-key: <Your API Key>' \
-H 'Content-Type: application/json' \
-d '{
"hookUrl": "<your webhook url>"
}'
fetch('https://api-prod-new.tagmango.com/api/v1/integration/webhook/webhook', {
method: 'DELETE',
headers: {
'accept': 'application/json',
'Content-Type': 'application/json',
'x-api-key': '<Your API Key>'
},
body: JSON.stringify({
"hookUrl": "<your webhook url>"
})
})
.then(response => response.json())
.then(data => console.log(data));
import requests
import json
url = "https://api-prod-new.tagmango.com/api/v1/integration/webhook/webhook"
headers = {
"accept": "application/json",
"Content-Type": "application/json",
"x-api-key": "<Your API Key>"
}
data = {
"hookUrl": "<your webhook url>"
}
response = requests.delete(url, headers=headers, json=data)
print(response.json())
Troubleshooting
Common Issues
-
Webhook not received
- Check if your endpoint is publicly accessible
- Verify the webhook URL is correct
- Ensure your server responds within 30 seconds
-
Authentication failures
- Verify API key is correct
- Check authentication header implementation
-
Duplicate events
- Implement idempotency using event-specific identifiers
- Store processed events to avoid duplicate processing
Support
If you need help with webhook implementation, contact our support team or check the API documentation for more details.