Configure a webhook to send notifications when someone joins your video calls

How to use the the meeting_join_hook property with the Daily.co API

If you want to offer video calls without scheduling times in advance, it can be helpful to receive a notification when a user joins a room. This can be useful, for example, if you're building a customer support service and you want to be notified when a user has joined.

You can do this in a few easy steps using a tool like [Zapier](https://www.daily.co/blog/use-zapier-to-get-notified-when-someone-joins-your-video-calls), but if you want to use your own endpoint to receive POST requests directly, you can configure a webhook for individual rooms. You can also receive notifications for all rooms in your subdomain for more complex use cases.

## Before you begin

To get started, you’ll need your API key, and an endpoint to receive POST requests. You also need some way to issue API calls, which can be done on our docs page or with a terminal program and `curl`.

## Create a room

First, we’ll create a room named "customer-service". Since we want anyone to be able to join this room, we’ll leave the privacy as “public”. We want to make sure to set the `meeting_join_hook` property to our endpoint URL to receive the POST requests, but the other properties can be left blank.

Your `curl` command might look something like this:

    -- CODE language-bash --
   curl --request POST \
   --url https://api.daily.co/v1/rooms \
   --header 'authorization: Bearer [your API key]' \
   --header 'content-type: application/json' \
   --data '{"name":"customer-service","properties":{"meeting_join_hook":"[your endpoint URL]"}}'

You should end up with a new room called “customer-service” configured with your endpoint URL. The server response should look similar to this:

    -- CODE language-bash --
   {"id":"fe76e3f9-6eeb-4572-a9f3-fe0745723f19","name":"customer-service","api_created":true,"privacy":"public","url":"https://your-subdomain.daily.co/customer-service","created_at":"2020-20-20T20:20:20.202Z","config":{"meeting_join_hook":"https://your.endpoint.url/"}}

## Receiving a notification

You can test the webhook by joining your test room. When a user joins your room, you should receive a POST request at your endpoint with information about the room and who joined. Keep in mind the user name field won't be populated unless they joined with a meeting token that contained a name, or they are logged into a [Daily.co](http://daily.co) account.

    -- CODE language-json --
   {
     "domain_name": "your-subdomain",
     "room_name": "customer-service",
     "room_url": "https://your-subdomain.daily.co/customer-service",
     "user_name": "Guest",
     "user_id": "87139f31-9a23-4f18-99f0-c84181e921ca",
     "is_owner": false,
     "owner_is_present": false,
     "first_non_owner_join": false,
     "meeting_session_id": "ab35ad88-35aa-4dde-a9e1-a5454a5be8c6"
   }

You can then use the resulting information from the request to initiate actions in your application, like notifying your support team that there is a user waiting. You can set different endpoints for each room if needed, so different rooms can send notifications to different URLs.

## Domain configuration

In addition to webhooks for a specific room, you can also receive notifications for all rooms in our subdomain. This can be useful for implementing things like usage tracking or responsive room management. The `curl` command to do this is similar to the one used for room creation, but targets the configuration for your domain:

    -- CODE language-bash --
   curl --request POST \
   --url https://api.daily.co/v1/ \
   --header 'authorization: Bearer [your API token]' \
   --header 'content-type: application/json' \
   --data '{"properties":{"meeting_join_hook":"[your endpoint URL]"}}'

Rooms that have the `meeting_join_hook` property set to a different URL won't send a POST request to the URL specified in the domain configuration, so you won't receive duplicate notifications.

## Summary

Using the [Daily.co](http://daily.co) API and `meeting_join_hook` makes it easy to add asynchronous video chat to any website or application. It can also be used to build custom functionality to better support your use case. For more information on how to use the Daily.co API, take a look at our docs pages, or some of our other blog posts.

Photo by [Evan Wise](https://unsplash.com/@evanthewise?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText) on [Unsplash](https://unsplash.com/s/photos/fishing?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText)

Recent posts