# Simple Web Server for Webhooks

## Goal

The goal of this page is to show you how you can do some automation around iMessage using the BlueBubbles Server and the webhook events that it emits.

## Building the HTTP Web Server

Before setting up any webhooks with the BlueBubbles Server, you need to create a web server to receive the webhook requests that the server will be emitting.

There are tools out there built for automation that do this for you such as [n8n](https://n8n.io/). However, if you want full controller over the code, I recommend building a webserver yourself.

Here are some quick implementation code in various languages.

{% embed url="<https://docs.bluebubbles.app/server/developer-guides/simple-web-server-for-webhooks/python-web-server>" %}

## Creating a Webhook

Once you've built your HTTP server, note the port that the server runs on (if running it on localhost).

Open up the BlueBubbles Server and open the `API & Webhooks` page. Then click on the `Manage` drop down, and select `Add Webhook`

![](https://3303548698-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FThJZqK6Woy4I46skzbiC%2Fuploads%2F6BFMpxz4HgSneIN0zh0R%2FCleanShot%202023-03-17%20at%2010.01.02.png?alt=media\&token=6cf5976a-9d06-4a0a-84a1-3f03203e574a)

In the popup, enter your webserver's URL + port (if on localhost). Here is an example where my localhost webserver is listening on port 8000:

![](https://3303548698-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FThJZqK6Woy4I46skzbiC%2Fuploads%2FPbWgjXd37ZBYpchNTs4s%2FCleanShot%202023-03-17%20at%2010.02.22.png?alt=media\&token=f48003d4-d07f-43c2-87fe-96af910664db)

Next, select the events you want to subscribe to from the `Event Subscriptions` drop down.

Lastly, hit save. You should see your new entry show up in the table.

<figure><img src="https://3303548698-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FThJZqK6Woy4I46skzbiC%2Fuploads%2Fy1tRBlirH8kFkPMWC3Hs%2FCleanShot%202023-03-17%20at%2010.03.30.png?alt=media&#x26;token=f6df7723-c3fe-4535-8d55-b266dd94f83e" alt=""><figcaption></figcaption></figure>

Assuming your webserver is running, it should now receive HTTP POST requests when the subscribed events are emitted from the server!

{% hint style="info" %}
If you have a cool automation project, please share it with us in our Discord! We love to see all the cool ways people are using BlueBubbles and its' API!
{% endhint %}
