2 title = "Format Webhooks for Pushover"
3 author = "@ssddanbrown"
4 date = 2023-10-20T16:00:00Z
5 updated = 2023-10-20T16:00:00Z
9 This is a hack to adapt outgoing webhooks from BookStack so that they are directly compatible with the [pushover message API](https://pushover.net/api#messages).
10 It specifically targets pushover webhook endpoints, so this won't affect non-pushover webhooks.
12 To use, you simply need to create a webhook in BookStack as normal, but use `https://api.pushover.net/1/messages.json` as the "Webhook Endpoint".
13 Review the options below to ensure you've configured the code for your Pushover instance.
15 This hack demonstrates how the format of webhooks can be altered via the logical theme system. This code could be taken and easily altered to suit other platforms where desired.
19 - Configure your Pushover API token & user key on lines 19-20, replacing the existing placeholder values between the string quotes.
20 - Additional options can be passed to the Pushover API via adding-to/altering the array passed back from the `formatWebhookDataForPushover` function.
21 - These are explained in the [Pushover API documentation](https://pushover.net/api).
22 - As an example, a `sound` parameter is set to use the tugboat notification sound for sent notifications. You can remove this to not define a specific notification sound.
26 - Your pushover credentials will be stored within your `functions.php` file. You may want to consider who will have access to this file since they'd be able to access your pushover account via the API.
30 {{<hack file="functions.php" type="logical">}}