Station Webhook Helper

class AzuracastPy.models.helpers.WebhookHelper(_station)

Provides a set of functions to interact with webhooks.

__call__(id: int) Webhook

Retrieves a specific SFTP user from the station.

Parameters:

id – The numerical ID of the SFTP user to be retrieved.

Returns:

A SFTPUser object.

Usage:

webhook = station.webhook(1)
__init__(_station)

Initializes a WebhookHelper instance.

Note

This class should not be initialized directly. Instead, obtain an instance via: webhook.

create(name: str, type: WebhookConfigTypes, webhook_config: Dict[str, Any], triggers: List[WebhookTriggers] | None = None) Webhook

Adds a webhook to the station.

Parameters:
  • name – The name of the webhook.

  • type – The type of the webhook. Use the WebhookConfigTypes enum to select a type.

  • webhook_config – The config object for the selected type. This can be generated using the generate_webhook_config() function.

  • triggers – (Optional) A list of triggers for the webhook. Each element of the list must be from the WebhookTriggers enum.

Returns:

A Webhook object for the newly created webhook.

Usage:

from AzuracastPy.enums import WebhookConfigTypes, WebhookTriggers

config = station.webhook.generate_webhook_config(
    subject="subject",
    message="message",
    to="to"
)

webhook = station.webhook.create(
    name="New email webhook",
    type=WebhookConfigTypes.EMAIL,
    webhook_config=config,
    triggers=[WebhookTriggers.STATION_ONLINE, WebhookTriggers.LIVE_CONNECT]
)
generate_webhook_config(webhook_url: str | None = None, basic_auth_username: str | None = None, basic_auth_password: str | None = None, timeout: int | None = None, to: str | None = None, subject: str | None = None, message: str | None = None, content: str | None = None, title: str | None = None, description: str | None = None, url: str | None = None, author: str | None = None, thumbnail: str | None = None, footer: str | None = None, bot_token: str | None = None, chat_id: str | None = None, api: str | None = None, text: str | None = None, parse_mode: str | None = None, instance_url: str | None = None, access_token: str | None = None, visibility: str | None = None, rate_limit: str | None = None, message_song_changed_live: str | None = None, message_live_connect: str | None = None, message_live_disconnect: str | None = None, message_station_offline: str | None = None, message_station_online: str | None = None, station_id: str | None = None, partner_id: str | None = None, partner_key: str | None = None, broadcastsubdomain: str | None = None, apikey: str | None = None, token: str | None = None, measurement_id: str | None = None, matomo_url: str | None = None, site_id: str | None = None)

Generates a config object for a webhook.

Returns:

A dictionary of the not-None attributes and their values.

Usage:

webhook_config = station.webhook.generate_webhook_config(
    subject="subject",
    message="message",
    to="to"
)