Webhook

A WebHook is a mechanism for asynchronously receiving event notifications.


WebHooks

After you submit an email delivery request to Aurora SendCloud, the system synchronously returns the request result (such as whether the request was accepted). The final delivery result of the email (such as whether it was successfully delivered) and other interaction events (such as opens and clicks) are asynchronously pushed to your specified server via WebHook.

Instead of requiring you to poll for updates, Aurora SendCloud actively pushes data to you in real-time when key events occur. This enables subsequent processes like data synchronization, statistical analysis, and triggering business workflows.

How It Works

Event Occurs: When an email-related event occurs (such as an email being opened, a recipient clicking a link, or the email bouncing), Aurora SendCloud generates corresponding data.

Trigger Notification: Aurora SendCloud immediately sends an HTTP POST request to the URL you configured in your account settings.

Data Transfer: The event data is contained within the body of the POST request, typically encoded in JSON format.

Receive & Process: Your server receives the request, parses the data, and handles subsequent business logic (such as updating a database or sending an internal alert) based on the event type.

Supported Event Types

Currently, Aurora SendCloud supports notifications for the following event types (partial list of common events):

EventDescription
RequestedSend request event
DeliveredMessage successfully delivered to the recipient's mail server
OpenRecipient opened the email
ClickRecipient clicked a link in the email
UnsubscribeRecipient clicked the unsubscribe link
Spam ComplaintRecipient complained the email as spam
Invalid EmailInvalid email address
Soft BounceSoft bounce (temporary delivery failure)
Inbound RouteRouting status event

For the complete official list of event types and their detailed payload formats, please refer to the [WebHook Event Format Documentation].

Configuration & Usage Steps

Set the WebHook URL: Log in to the Aurora SendCloud platform, navigate to the WebHook settings page, and specify the API endpoint URL on your server that will receive the events.

Validate the Endpoint: Ensure your server can correctly handle any validation requests sent by Aurora SendCloud to confirm URL accessibility.

Parse Event Data: Write code to parse the JSON data in the POST request body and handle it accordingly based on the event type (such as identified by an event field).

Return Success Status: After successfully receiving and processing the data, your server should return a 2xx HTTP status code (such as 200 OK) to Aurora SendCloud. If a non-2xx status code is returned, Aurora SendCloud may attempt to retry the notification based on its retry policy.

Important Notes

Retry Mechanism: If your server is unreachable or does not return a successful response, Aurora SendCloud will typically retry the notification after a delay, up to a predefined retry limit. The retry schedule is as follows: 1 minute, 10 minutes, 30 minutes, 1 hour, 6 hours, 12 hours, and 24 hours. This provides ample time to resolve any issues before the message is lost. If the retry count is exceeded, Aurora SendCloud will store the message for 15 days. For a repush, please contact us.

Security Verification: It is highly recommended to implement security checks in your endpoint code (such as verifying the request source IP against a whitelist or validating a signature) to ensure requests are genuinely from Aurora SendCloud and prevent spoofing.

Processing Performance: Ensure your receiving endpoint can respond quickly (not longer than 3 seconds) to avoid timeouts that might cause Aurora SendCloud to misinterpret the delivery as a failure.


WebHook Event Description

Requested ( request )

ParameterTypeDescription
eventstringevent type: “request”
messagestringmessage content
maillistTaskIdlongtask ID will be generated when you send emails with address list
mail_list_task_idlongtask ID will be generated when you send emails with address list
messageIdstringmessageId
apiUserstringAPI_USER
categorystringmessage ID
recipientArraylistrecipients
emailIdslistemailId array
labelIdintcustom label ID
labelNamestringcustom label name
recipientSizeintcount of requests
timestamplongtimestamp
tokenstringrandom string of 50 characters
signaturestringsignature string
userHeadersstringcustom header with start of “SC-Custom”
sendTagsstringTags for the request (separated by ";", max 5 tags, each up to 50 characters)

Delivered( deliver )

parametertypedescription
eventstringevent type: "deliver"
messagestringmessage content
apiUserstringAPI_USER
categorystringAPI_USER
maillistTaskIdlongtask ID will be generated when you send emails with address list
mail_list_task_idlongtask ID will be generated when you send emails with address list
emailIdstringunique ID of each email
outIpstringoutbound IP address
recipientstringrecipients
labelIdintcustom label ID
labelNamestringcustom label name
timestamplongtimestamp
tokenstringrandom string of 50 characters
signaturestringsignature string
userHeadersstringcustom header with start of "SC-Custom"
sendTagsstringTags for the request (separated by ";", max 5 tags, each up to 50 characters)
deliveryLatencylongRequest-to-delivery latency of email

Open ( open )

parametertypedescription
eventstringevent type: "open"
messagestringmessage content
apiUserstringAPI_USER
categorystringAPI_USER
maillistTaskIdlongtask ID will be generated when you send emails with address list
mail_list_task_idlongtask ID will be generated when you send emails with address list
emailIdstringunique ID of each email
recipientstringrecipients
labelIdintcustom label ID
labelNamestringcustom label name
ipstringopened IP address
explorerNamestringbrowser name
explorerVerstringbrowser version
oSNamestringOS name
oSVerstringOS version
timestamplongtimestamp
tokenstringrandom string of 50 characters
signaturestringsignature string
userHeadersstringcustom header with start of "SC-Custom"
sendTagsstringTags for the request (separated by ";", max 5 tags, each up to 50 characters)

Click ( click )

parametertypedescription
eventstringevent type: "click"
messagestringmessage content
apiUserstringAPI_USER
categorystringAPI_USER
maillistTaskIdlongtask ID will be generated when you send emails with address list
mail_list_task_idlongtask ID will be generated when you send emails with address list
emailIdstringunique ID of each email
recipientstringrecipients
labelIdintcustom label ID
labelNamestringcustom label name
urlstringclicked links
ipstringclicked IP addresses
explorerNamestringbrowser name
explorerVerstringbrowser version
oSNamestringOS name
oSVerstringOS version
timestamplongtimestamp
tokenstringrandom string of 50 characters
signaturestringsignature string
userHeadersstringcustom header with start of "SC-Custom"
sendTagsstringTags for the request (separated by ";", max 5 tags, each up to 50 characters)

Unsubscribe ( unsubscribe )

parametertypedescription
eventstringevent type: "unsubscribe"
messagestringmessage content
apiUserstringAPI_USER
categorystringAPI_USER
labelIdintcustom label ID
labelNamestringcustom label name
maillistTaskIdlongtask ID will be generated when you send emails with address list
mail_list_task_idlongtask ID will be generated when you send emails with address list
emailIdstringunique ID of each email
recipientstringrecipients
ipstringIP address
explorerNamestringexplorer name
explorerVerstringexplorer version
oSNamestringOS name
oSVerstringOS version
timestamplongtimestamp
tokenstringrandom string of 50 characters
signaturestringsignature string
userHeadersstringcustom header with start of "SC-Custom"
sendTagsstringTags for the request (separated by ";", max 5 tags, each up to 50 characters)

Spam Complaint ( report_spam )

parametertypedescription
eventstringevent type: "report_spam"
messagestringmessage content
apiUserstringAPI_USER
categorystringAPI_USER
labelIdintcustom label ID
labelNamestringcustom label name
emailIdstringunique ID of each email
recipientstringrecipients
timestamplongtimestamp
tokenstringrandom string of 50 characters
signaturestringsignature string
userHeadersstringcustom header with start of "SC-Custom"
sendTagsstringTags for the request (separated by ";", max 5 tags, each up to 50 characters)

Invalid Email ( invalid )

parametertypedescription
eventstringevent type: "invalid"
messagestringmessage content
apiUserstringAPI_USER
categorystringAPI_USER
labelIdintcustom label ID
labelNamestringcustom label name
maillistTaskIdlongtask ID will be generated when you send emails with address list
mail_list_task_idlongtask ID will be generated when you send emails with address list
emailIdstringunique ID of each email
outIpstringoutbound IP address
recipientstringrecipients
timestamplongtimestamp
tokenstringrandom string of 50 characters
signaturestringsignature string
userHeadersstringcustom header with start of "SC-Custom"
subStatDescstringinvalid subclass description
subStatintegerinvalid subclass
sendTagsstringTags for the request (separated by ";", max 5 tags, each up to 50 characters)
asynchronousBounceinteger0 indicates synchronous bounce, with a default value of 0; 1 indicates asynchronous bounce. Learn more, please reference to Data

Substat's Return Code and Description

subStatsubStatDesc
401in Aurora SendCloud blacklist
402unsubscribe
403server unreachable
404address format error
405IP and domain rejected
406address does not exist
407spam
408sender / recipient rejected
409others

Soft Bounce ( soft_bounce )

parametertypedescription
eventstringevent type: "soft_bounce"
apiUserstringAPI_USER
categorystringAPI_USER
labelIdintcustom label ID
labelNamestringcustom label name
maillistTaskIdlongtask ID will be generated when you send emails with address list
mail_list_task_idlongtask ID will be generated when you send emails with address list
emailIdstringunique ID of each email
outIpstringoutbound IP address
recipientstringrecipients
timestamplongtimestamp
tokenstringrandom string of 50 characters
signaturestringsignature string
userHeadersstringcustom header with start of "SC-Custom"
subStatDescstringsoft bounce subclass description
subStatintegersoft bounce subclass
causestringreasons for soft bounce
sendTagsstringTags for the request (separated by ";", max 5 tags, each up to 50 characters)
asynchronousBounceinteger0 indicates synchronous bounce, with a default value of 0; 1 indicates asynchronous bounce. Learn more, please reference to Data

Substat's Return Code and Description

subStatsubStatDesc
503service not available
505ip or domain rejected
506email address does not exist
507spam
508sender / recipient rejected
509others

Inbound Route (route)

parametertypedescription
eventstringevent type: "route"
messagestringmessage content "mx route"
timestamplongtimestamp
fromstringsender email address
fromnamestringsender name
tostringrecipients address
tonamestringrecipient name
x_mx_mailfromstringenvelope sender
x_mx_rcpttostringActual recipient address
headersstringemail headers, formatted with JSON
htmlstringcontent in html format of routing email
textstringcontent in text format of routing email
subjectstringsubject
raw_message_urlstringThe download link of the route email, the suffix of the download file is '.eml', and the link is valid for 15 days
raw_messagestringraw email
tokenstringrandom string of 50 characters
signaturestringsignature string
userHeadersstringCustom header with start of "SC-Custom"
referencestringIf there is a value, it is: Message-ID of the email sent by Aurora SendCloud
emailIdstringThe unique id of the parent email. This field allows the reply email to be associated with the parent email. This value is parsed from reference and In-Reply-To.
labelIdintParent email customized label ID
labelNamestringParent email customized label Name

Note:

  1. When you do not pass in a custom Message-ID, the Message-ID in reference is automatically generated according to the platform rules, and the prefix of the Message-ID is the same as the prefix of the emailid. When you pass in a custom Message-ID through an SMTP request, the Message-ID in reference will be the Message-ID you passed in. When the reply email does not match the parent email, it will be empty.
  2. eg:"reference":"[email protected] (opens new window) " #ifaxin.com is the send domain name.
  3. Java parsing EML file example,click here download


Code examples

Python example

import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;

import org.apache.commons.codec.binary.Hex;

public boolean verify(String appkey, String token, long timestamp,
            String signature) throws NoSuchAlgorithmException, InvalidKeyException {
    Mac sha256HMAC = Mac.getInstance("HmacSHA256");
    SecretKeySpec secretKey = new SecretKeySpec(appkey.getBytes(),"HmacSHA256");
    sha256HMAC.init(secretKey);
    StringBuffer buf = new StringBuffer();
    buf.append(timestamp).append(token);
    String signatureCal = new String(Hex.encodeHex(sha256HMAC.doFinal(buf
            .toString().getBytes())));
    return signatureCal.equals(signature);
}
import hashlib, hmac
def verify(appkey, token, timestamp, signature):
    return signature == hmac.new(
        key=appkey,
        msg='{}{}'.format(timestamp, token),
        digestmod=hashlib.sha256).hexdigest()
function verify($appkey,$token,$timestamp,$signature){
    $hash="sha256";
    $result=hash_hmac($hash,$timestamp.$token,$appkey);
    return strcmp($result,$signature)==0?1:0;
}

Experience Now

If you don’t have url to receive data,try services of requestb.in or request this to experience WebHook.

  1. Click Create a RequestBin to generate an url
  2. Configure the URL in Aurora SendCloud to receive event data from WebHook
  3. After an operation (request, deliver, open), you can see all POST data of the event in requestb.in