# Learn about WebHook
When users submit delivery request to SendCloud, 「request result」 will be simultaneously returned to users; 「delivery result」 and 「results of other event」 will be asynchronously returned to users via WebHook.
# WebHook mechanism:
- SendCloud provides mail events for users to choose
- When an event occurs, the URL set by SendCloud will be triggered to send data (POST)
- The type of data pushed is:"Content-Type: application/x-www-form-urlencoded"
- The customer receives the data, resolves the event and data, and needs to return HTTP status code 200 within 3S. Otherwise, SendCloud will resend the message
- Webhook parsing example, Click here
目前 SendCloud 支持的邮件事件如下:
事件 | 触发条件 |
---|---|
request(request) | email is successfully requested |
delivered(deliver) | email is successfully sent |
open(open) | user opens email |
click(click) | user clicks link |
unsubscribe(unsubscribe) | user unsubscribes email |
spam-reporting(report_spam) | user reports email as a spam |
invalid email(invalid) | email delivery failed |
soft bounce(soft_bounce) | email is rejected by recipient |
Mail Routing(route) | forward email/mail routing |
# Usage Method:
- Users write HTTP service to process events, analyze data and release URL.
- Choose interested events in
WebHook
and configure URL.
# Signature Verification
To ensure that the message is sent from SendCloud, you can choose to verify the source of the POST data. (You can also analyze POST data without verification).
Verification method is as below:
- Acquire
APP KEY
in【Delivery Settings】-【WebHook】
- Analyze
token
,timestamp
andsignature
in POST data - Generate signature with
APP KEY
,token
andtimestamp
; check withsignature
in POST data ( signature algorithm: SHA256 (opens new window))
# Retrial mechanism
If URL request error or timeout occurs, SendCloud will retry at most 5 times and the interval between is 1, 2, 4, 8, and 16 minutes, so you have at least half an hour to repair URL before the data is lost.
Once retry limit is reached, the data will be lost.
You need to return to HTTP code 200 in three seconds when processing events and analyzing data, otherwise, SendCloud will resend the message.