Learn about SMSHook

Last updated:2023-04-10

SMSHook is the channel through which customers receive their transmission information. After the user sends an email request to EngageLab, EngageLab will synchronously return the "request result" to the user, and the "send result" and "other event results" of the email are asynchronously returned to the user through SMSHook.

Processing of SMSHook

  • EngageLab provides customers with some email events that they can choose to follow
  • When an event occurs, EngageLab will be triggered to send data (POST) to the URL set by the customer
  • The data type pushed by Engage lab is "Content Type: application/JSON"
  • The customer receives the data, parses the event and data, and you need to return HTTP Status Code 200 within 3 seconds. Otherwise, Engage lab will resend the message.

Usage Method

  • Users can write their own HTTP services to handle corresponding events, parse relevant data, and open corresponding URLs
  • Users select the events to follow in the SMSHook of EngageLab and configure the URL to receive data

Signature verification

To ensure that the source identity of the message is EngageLab, you can choose to perform security authentication on the source of POST data (Without verification, it is also possible to directly parse POST data)

The methods for security authentication are as follows:

  • Obtain the APP SECRET through [Send Settings] - [SMSHook]
  • Resolve the X-SMSHook Timestamp in the header
  • Resolve the X-SMSHook AppKey in the header
  • Resolve the X-SMSHook Signature in the header
  • Generate a signature using md5 (timestamp+appkey+secret) and compare it with X-SMSHook Signature

Response Processing

After receiving the callback from EngageLab, the developer service needs to respond within 3 seconds according to the following requirements.

Successful reception: the HTTP response status code needs to return 200 or 204, and no response message needs to be returned.

Receiving failure: HTTP response status code needs to be returned to 5XX or 4XX, and response message needs to be returned at the same time, with the format as follows:

{"code":2002,“message”:"failed"}

Parameter Type Required/Optional Description
code int Optional Error code
message string Optional Error details

Retry Processing

If you encounter a URL access error or timeout, EngageLab will retry at most 7 times The maximum time interval between each retry is 3min, 10min, 30min, 1h, 6h, 12h and 24h That is, you have enough time to repair the URL before the message is lost.

If the number of retries is exceeded, EngageLab will discard the message.

For each event processing and data analysis, you need to return [Successful response received] within 3s. Otherwise, EngageLab will resend this message.

在文档中心打开