# Webhooks

You can configure Userfront to make a callback request to your server each time a user or tenant is created, updated, or deleted. These requests are called webhooks (opens new window), and they contain information about the user or tenant that changed.

Userfront webhooks are made via POST request and include a token in the header that your server can use to verify that the request came from Userfront.

# Authentication

Userfront includes a token in the header of each webhook that you can use to authenticate the request. You can view your Webhook tokens in the Userfront Dashboard.

Do not share your Webhook tokens in publicly accessible areas such as GitHub, client-side code, and so forth.

Webhook tokens are included as HTTP Bearer Auth (opens new window) tokens, included in the header of each request as: Authorization: Bearer your_webhook_token.

All live webhooks must be made over HTTPS. Webhooks configured for plain HTTP will fail.

# Webhook token

Each webhook will have an authorization header containing your account's webhook token.

Your server should read this header and verify that it matches the webhook token found in your dashboard.

{
  headers: {
    authorization: "Bearer example3c5cc4491eb422d48c8f78c2f"
  }
}

# Users

Users are the user records within your account or within your account's tenants.

There are webhooks available for user creation, update, and deletion.


# User created

This webhook is sent whenever a new user is created.

# Parameters


# action 

The type of action: "create"


# model 

The model name: "user"


# mode 

Whether the action was performed in test mode or live mode.


# record 

The user record that was created.


Webhook request body

{
  "action": "create",
  "model": "user",
  "mode": "test",
  "record": {}
}

# User updated

This webhook is sent whenever an existing user is updated.

# Parameters


# action 

The type of action: "update"


# model 

The model name: "user"


# mode 

Whether the action was performed in test mode or live mode.


# record 

The user record that was updated.


Webhook request body

{
  "action": "update",
  "model": "user",
  "mode": "test",
  "record": {}
}

# User deleted

This webhook is sent whenever a user is deleted.

# Parameters


# action 

The type of action: "delete"


# model 

The model name: "user"


# mode 

Whether the action was performed in test mode or live mode.


# record 

The user record that was deleted.


Webhook request body

{
  "action": "delete",
  "model": "user",
  "mode": "test",
  "record": {}
}

# Tenants

Tenants allow you to sub-divide your application so that certain users only have access to certain parts.

There are webhooks available for tenant creation, update, and deletion.


# Tenant created

This webhook is sent whenever a new tenant is created.

# Parameters


# action 

The type of action: "create"


# model 

The model name: "tenant"


# mode 

Whether the action was performed in test mode or live mode.


# record 

The tenant record that was created.


Webhook request body

{
  "action": "create",
  "model": "tenant",
  "mode": "test",
  "record": {}
}

# Tenant updated

This webhook is sent whenever an existing tenant is updated.

# Parameters


# action 

The type of action: "update"


# model 

The model name: "tenant"


# mode 

Whether the action was performed in test mode or live mode.


# record 

The tenant record that was updated.


Webhook request body

{
  "action": "update",
  "model": "tenant",
  "mode": "test",
  "record": {}
}

# Tenant deleted

This webhook is sent whenever a tenant is deleted.

# Parameters


# action 

The type of action: "delete"


# model 

The model name: "tenant"


# mode 

Whether the action was performed in test mode or live mode.


# record 

The tenant record that was deleted.


Webhook request body

{
  "action": "delete",
  "model": "tenant",
  "mode": "test",
  "record": {}
}
Last Updated: 4/30/2021, 10:07:46 PM