Skip to main content

Webhooks

The webhook API provides a straightforward method for sending requests to a remote server each time some interactions happen in WorkAdventure.

info

As of now, the only supported action is the authentication event.

Setting up a Webhook

To set up a webhook, you need to go to the Developers > Webhook settings page of the admin dashboard and provide the URL of the endpoint that will receive the webhook requests.

Webhook Settings

Webhook Payload

When the webhook is triggered, it sends a POST request with a JSON body containing four parameters:

  • action: The action that triggered the webhook (so far, it will always return auth)
  • roomUrl: Represents the URL of the room.
  • uuid: Represents the unique identifier of the member.
  • accessToken: The OAuth2 access token of your user (if you did set up the OAuth2 authentication).

Your webhook will be invoked using a curl command similar to the following:

curl --location 'your_webhook_url' \
--header 'Content-Type: application/json' \
--data-raw '{
"roomUrl": "room_url",
"uuid": "39afd085-c606-4a3e-b68e-d1d7ebeff82b",
"accessToken": "your_access_token"
"action": "auth"
}'

Webhook actions

As of now, the only supported action is the authentication event (auth). This event is triggered each time WorkAdventure performs a security check to see if a user is allowed to access a room.

Sample usage

The auth event can be used to alter the behavior of the authentication process. The hook is triggered before the authentication is performed, so when you receive the authentication event, you can perform additional checks on your server and alter the member's tags in WorkAdventure using the Inbound API.

Let's imagine that you want to allow access to a meeting room based on a calendar in your database. When a user tries to access the room, WorkAdventure will send a auth event to your server. You can then check if the user has a meeting scheduled at the time of the request. If yes, you can add a "meeting" tag to the user using the Inbound API (that will grant access to the room) and if not, you can remove the "meeting" tag (that will deny access to the room).

Debugging Webhooks

If you are not receiving the webhook requests, you can check the logs in the admin dashboard to see if there are any errors.

The logs are available in the Developers > Webhook settings page of the admin dashboard.