Here is a sample of a web server written in Python to receive new message events.
Most of the code below is boilerplate code. The important pieces to change are lines 9 and 64-104.
On line 9, you need to set your server password.
Lines 64-104 define which events are handled, and how they are being handled. Those are likely the lines you want to modify the most to customize the functionality.
This page will show you how you can create a simple HTTP web server to receive webhooks from the BlueBubbles Server.
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.
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. However, if you want full controller over the code, I recommend building a webserver yourself.
Here are some quick implementation code in various languages.
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
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:
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.
Assuming your webserver is running, it should now receive HTTP POST requests when the subscribed events are emitted from the server!
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!