Webhooks

Webhooks are a way to receive HTTP POST requests from Hyvor Relay when certain events occur. They are useful to sync state (email sending status) between Hyvor Relay and your application or to trigger actions in your application based on events in Hyvor Relay.

Events & Payloads

send.accepted

send.accepted is triggered when an email is accepted by the recipient SMTP server. This can only be triggered once for a send. It indicates that the email has been successfully delivered to the recipient's server, but it does not guarantee that the email has been delivered to the recipient's inbox. send.bounced or send.complained can be triggered later if the email is not delivered to the recipient's inbox (ex: when the mailbox is full, or if the email provider's spam detector detects the mail as spam) or if the recipient marks it as spam.

{
	send: Send;
	attempt: SendAttempt;
}

send.deferred

send.deferred is triggered when an email is temporarily deferred by the recipient SMTP server. This can happen for various reasons, such as the recipient's server being busy or because of greylisting. Hyvor Relay will retry sending the email a few more times before giving up. You can expect a send.accepted or send.bounced event later.

{
	send: Send;
	attempt: SendAttempt;
}

send.bounced

send.bounced is triggered when an email is permanently rejected by the recipient SMTP server. This can happen for various reasons, such as the recipient's email address not existing or the recipient's server rejecting the email due to spam filters.

  • Synchronous Bounces: In some cases, bounces are detected immediately in the SMTP conversation when sending the email. In such cases, the send.bounced event is triggered immediately.
  • Asynchronous Bounces: In other cases, the bounce is detected later, such as when the recipient's server sends a bounce notification (Delivery Status Notification, DSN) after some time. In such cases, a send.accepted event is triggered first, followed by the send.bounced event when the bounce is detected.

If we detect a hard bounce (permanent failure) for a send, the email address is automatically added to your project's suppression list. This means that you cannot send emails to that email address again unless you manually remove it from the suppression list. This is to prevent sending emails to invalid email addresses, which can harm your sender reputation.

{
	send: Send;
	attempt: SendAttempt | null;
	bounce: Bounce;
}

send.complained

When a recipient marks an email as spam, the email provider sends a complaint, called a Feedback Loop (FBL), to Hyvor Relay. Hyvor Relay is configured to receive FBLs from major email providers.bind: We process these complaints and trigger the send.complained event. This event indicates that the recipient has marked the email as spam or junk. When this event is triggered, the email address is automatically added to your project's suppression list, similar to when a hard bounce occurs.

{
	send: Send;
	complaint: Complaint;
}

Retrying

When Hyvor Relay sends a webhook, it expects a 2xx HTTP response code from your application. If it does not receive a 2xx response, it will retry sending the webhook up to 6 times with the following intervals between retries:

  • 1 minute
  • 5 minutes
  • 15 minutes
  • 1 hour
  • 4 hours
  • 24 hours

If all retries fail, the webhook delivery will be marked as failed, and you can view the delivery status in the Hyvor Relay Console, including the error message received from your server.