Sign in Create account
Integrations

Auth0

Auth0 sign-ups, logins and deletions through a Log Stream, and every Auth0 email sent through Postal with Actions.

With Auth0, Postal receives the sign-up, login and deletion logs through a Log Stream, and can send all Auth0 emails through the custom email provider.

#Create the connection

In the dashboard, open Integrations › Your app and click Connect on the Auth0 card. The connection has its own URL, which you paste into the provider, and it shows the step-by-step instructions on the same screen.

Connection URL (example)
https://api.postal.so/integrations/crm/01a1c2d3-e4f5-7a6b-8c9d-0e1f2a3b4c5d/webhook

In Auth0, open Monitoring › Streams and create a Custom Webhook stream:

FieldValue
Payload URLThe connection URL
Authorization TokenBearer followed by the secret shown on the connection
Content Typeapplication/json
Content FormatJSON Array (or JSON Object)
Filter by CategorySign Up, Login and User/Behavioral

App integrations count toward your plan limit (app_integrations). If they are not in your plan, the cards appear locked with an Upgrade button.

#Events

Log typePostal eventDefault
ss (sign-up)auth0.user.signed_upon
s (login)auth0.user.logged_inoff
sv (email verified)auth0.user.email_verifiedon
scp (password changed)auth0.user.password_changedon
sdu (user deleted)auth0.user.deleted (a deletion)on

The user is matched by the Auth0 user_id (auth0|…), stored in external_id; the email comes from user_name. The properties are user_id, connection, client_name, log_id and date.

For deletions, the connection says what to do with the contact: only record the event (the default), unsubscribe the contact (it stays in the audience, but receives no marketing) or delete the contact (no event, since the contact is gone). A deletion never creates a contact that Postal did not have.

#Connection settings

  • Events: only the checked ones become a contact and an event; the others are ignored (the response is still 202).
  • Sync the name: updates the contact's first and last name with what the provider sends.
  • Add to segment and Subscribe to topic: a static segment and a topic for every contact that arrives.
  • When the user is deleted in the app: only record the event, unsubscribe the contact or delete it.

Everything the connection changes on a contact carries the source crm:<connection id> (last_change_source), and each delivery appears in the connection's log, with the result for each person. A delivery that the provider repeats (same ID) is not processed twice.

#Auth0 emails through Postal

No connection needed: Auth0's custom email provider runs an Action for every email (verification, welcome, password reset, invitation, MFA). Under Branding › Email Provider, choose Custom Provider, create the Action and store your Postal API key as the POSTAL_API_KEY secret:

Action: Custom Email Provider
exports.onExecuteCustomEmailProvider = async (event, api) => {
  const response = await fetch('https://api.postal.so/emails', {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${event.secrets.POSTAL_API_KEY}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      from: 'Acme Store <[email protected]>',
      to: [event.notification.to],
      subject: event.notification.subject,
      html: event.notification.html,
      text: event.notification.text,
      tags: [{ name: 'auth0', value: event.notification.message_type }],
    }),
  })

  if (response.status === 429 || response.status >= 500) {
    api.notification.retry(`Postal responded with ${response.status}`)
  } else if (!response.ok) {
    api.notification.drop(`Postal responded with ${response.status}`)
  }
}

Use a sending-only key, preferably restricted to the sender's domain. The templates stay in Auth0 (Branding › Email Templates).

#Trigger automations

Each event is stored on the contact under the name auth0.user.signed_up, with the properties from the table above. On the connection screen, the Create automation button next to each event opens a new automation with the Event received trigger already filled in. Through the automations endpoints, the trigger is {"type": "event", "event": "auth0.user.signed_up"}.

Example: a welcome email at sign-up and a security tip after auth0.user.password_changed. In the emails, the event properties are available as {{event.amount}} in the steps or as template variables ({{{amount}}}).