Webhooks Overview

Webhooks allow SMTP2GO to notify your web service via an HTTP or HTTPS POST request whenever an email or SMS event happens in your account. For example, you can choose to be instantly notified if an email bounces, when an open occurs or if a spam complaint is recorded.

📘

Slack

If your notification needs are simple, consider using our Slack integration instead.

The setup and management of Webhooks are handled on the "Settings > Webhooks" page in the SMTP2GO App or via the API. View the Setup a Webhook page for the steps involved.

Webhooks can be set for selected SMTP Users, API Keys or Authenticated IPs.

Webhook Events - Email

The events you can select to be notified of include:

EventDescription
ProcessedThe email was received by our incoming servers and is being processed for delivery. If multiple delivery attempts are occurring and not yet successful, the email will remain in the Processed status.
DeliveredThe email was successfully delivered to the recipient and this is confirmed when the recipient server provides a “250” response.
OpenThe email was opened by the recipient. A new open event can be triggered each time the recipient opens the email. For full details regarding open tracking and its limitations, view our open tracking article.
ClickThe recipient clicked a tracked link in the email. A new click event can be triggered each time the recipient clicks on a link.
BounceThe email was bounced by the recipient server when delivery was attempted. Bounces are classified as Soft or Hard depending on the response from the recipient server.
SpamThe recipient marked an email as spam or manually moved it to their spam folder. When this occurs, it triggers a spam complaint and the recipient email address is indefinitely added to your Suppressions page. The address can be managed on the “Reports > Suppressions” page in the App or via the API. If delivery is attempted to a suppressed address, it will be rejected.
UnsubscribeA recipient unsubscribed from receiving your emails using the Unsubscribe Footer. When this occurs, the address will be indefinitely added to your account’s Suppressions page. It can be managed on the “Reports > Suppressions” page in the App or via the API. If delivery is attempted to a suppressed address, it will be rejected.
ResubscribeA recipient went to the unsubscribe link they previously unsubscribed via and resubscribed or the address has been removed from the Suppressions page.
RejectAn email will be rejected if you attempt to send it to an address that is listed on the account’s "Reports > Suppressions" page or if sending is attempted from an unverified sender, or the SMTP User/Authenticated IP/API Key status is set to Sandboxed.

Webhook Parameters - Email

The Webhook URL will receive an HTTP or HTTPS POST request with the following parameters:

ParameterDescription
eventWhat happened: "processed", "delivered", "open", "click", "bounce", "spam", "unsubscribe", "resubscribe", or "reject".
timeUTC timestamp of when the event happened.
sendtimeUTC timestamp of when the email was sent to our server.
senderThe 'envelope-from' email address.
fromThe email address the email was sent from.
rcptThe email address the email was addressed to.
recipientsThe email addresses the email was sent to.
authThe SMTP Username, API Key or IP Address used to send the email.
hostThe recipient server that bounced the message (bounce only).
messageThe error message we got (where available).
contextContains additional information on the event (where available).
email_idAn identifier that uniquely identifies the email, which can be used to retrieve further details of the email delivery.
bounceThis parameter will be included for a bounce event, and will be either hard or soft, depending on how we classify the bounce type.
subjectThe subject of the email.
user-agentThe "User-Agent" header of the device that opened the email (where applicable)
read-secsThe number of seconds an email was open - in five second increments up to a maximum of 30 (where applicable).
clientThe reported client that clicked/opened the link (based on the User-Agent).
client-deviceThe reported device type of the User-Agent associated with the open/click event (where available).
client-osThe reported device operating system of the User-Agent associated with the open/click event (where available).
geoip-continentA 2 character continent code based on a geoip lookup of the IP address associated with the open/click event (where available).
geoip-countryA 2 character country code based on a geoip lookup of the IP address associated with the open/click event (where available).
geoip-cityThe name of the city based on a geoip lookup of the IP address associated with the open/click event (where available).
srchostThe IP address of the end-user associated with an open/click event (where available) or the IP address that submitted the email (for processed events).

Webhook Events - SMS

The events you can select to be notified of include:

EventDescription
SendingThe SMS is currently being processed.
SubmittedThe SMS has been submitted to the downstream provider - i.e. a local SMS network provider. Messages with this status have often been delivered successfully, but the downstream provider hasn't provided confirmation.
DeliveredThe SMS is sent and delivery is confirmed by the downstream provider.
FailedThe SMS failed to be delivered, for a reason such as: a message validity check failed, a gateway failure occurred, the message was dropped, the message was detected as duplicate and dropped, etc.
RejectedThe SMS was blocked by the SMS network. e.g. the destination address has blocked the sender.

Webhook Parameters - SMS

The Webhook URL will receive an HTTP or HTTPS POST request with the following parameters:

ParameterDescription
eventWhat happened: "sms_submitted", "sms_delivered", "sms_rejected", "sms_sending", or "sms_failed".
destination_numberThe number the SMS is being sent to.
email_subjectThe subject of the email (if email to SMS).
idThe unique id for the webhook.
message_contentThe body content of the SMS message.
message_idThe uniqie id for the SMS.
recevied_timestampUTC timestamp of the event.
regionThe destination based on the number's country code.
retry_countThe number of attempts to send the SMS.
sender_emailThe From email address.
source_numberThe pool/number the SMS was delivered from.
status_codeThe status code of the SMS.
submitted_timestampUTC timestamp of when the SMS was submitted to the downstream provider.

Webhook Request

SMTP2GO sends a POST (not a GET) request to your URL with the data output type of "JSON" or "Form encoded" depending on what type is defined in the webhook's settings.

URL Format

Each 'URL of web service' that you enter must follow the URI standard.
E.g.
PROTOCOL "://" USER ":" PASSWORD "@" HOST "/" PATH "?" QUERY "#" FRAGMENT

with most parts of that being optional.

PROTOCOL can be either HTTP or HTTPS.
USER and PASSWORD are only required if you choose to password protect your web service.

Secure the URL

You can optionally secure your public URL with a username/password, with formats such as the following (the URLs given below are just examples):

https://USERNAME:[email protected]/webhook/smtp2go

https://host.yourdomain.com/webhook/smtp2go?p=PASSWORD

or simply make the name of the endpoint hard to guess:

https://host.yourdomain.com/webhook/smtp2go_PASSWORD

Secure the Endpoint

You can optionally further secure your endpoint with our webhook delivery IP addresses by using the A record for "webhooks.smtp2go.com".

Optional Email Headers

Custom email headers can optionally be reported along with the standard data above. You can specify the headers you wish to receive for the specific Webhook on its "Settings" section in the App or via the API.

any_custom_header
any custom header that is sent in your emails.

You can add multiple headers to be returned.

Webhook Retries and Timeout

Webhook failures will retry for up to 48 hours, a maximum of 35 times with the following timings:

  • 5 times in the first 30 minutes
  • Every hour for the next 24 hours
  • Every 6 hours for the next 24 hours
  • Every 12 hours for the next 24 hours
  • Once final attempt after 24 hours

Failures can be seen in the App on the "Settings > Webhooks > Failed Notifications" section where you can view, retry, and cancel any failed notification attempts. You can delve into specific failures to see a summary, request data and all attempts.

The default timeout for a Webhook is 10 seconds. A timeout will occur if we do not receive any response headers in that timeframe.

Number of Webhooks

Accounts on the free plan are limited to 1 webhook and accounts on paid plans can create up to 10.

Testing Webhooks

A good way to start testing is to deploy a local version of RequestBin, which will let you see exactly what data we send to you. Another option to try is Beeceptor.