Notifications¶
The functions of connectors.notifications.store, taken from their docstrings.
connectors.notifications.store
¶
get_setting(type_id, channel)
¶
(enabled, ids of the fields shown) of a notification on a channel. No row yet: off, every field.
is_enabled(type_id, channel)
¶
On for the notification, and the connector of the channel is not paused.
check_fields(ntype, channel, fields)
¶
Ids to show, in catalogue order. Raises ValueError for anything the catalogue does not allow.
default_template(ntype, channel, selected=None)
¶
The message of the catalogue as editable text: the starting point of a message written by hand.
default_title(ntype, channel)
¶
Title of the TheHive alert or subject of the email, as the catalogue has it ('' when the channel has none).
variables(ntype)
¶
What a message of this notification can read: [{'name', 'sample'}], from the fictional sample.
save_setting(type_id, channel, enabled=None, fields=None, template_text=UNSET, title=UNSET)
¶
Switch a notification on or off on a channel, choose the fields of its message, or replace its message (and the
title of the TheHive alert or subject of the email) with text written by hand. None as template_text or title
goes back to the catalogue's. Returns what is stored.
KeyError: unknown notification or channel. ValueError: the notification has no such message, or a bad value.
render_message(type_id, channel, ctx)
¶
Text of a notification on Slack, Citadel or TheHive (description), with the fields saved in the settings.
render_thehive_title(type_id, ctx)
¶
Title of the TheHive alert: the one written by hand, else the catalogue one.
render_per_alert(type_id, ctx)
¶
(title, description) of the fixed TheHive alert opened for each alert of a group notification.
email_subject(type_id, ctx)
¶
Subject of the e-mail: the one written by hand, else the catalogue one.
thehive_meta(type_id)
¶
Tags, type and severity of the TheHive alert of a notification.
describe(type_id)
¶
One notification as the API shows it: its channels, what is on, the fields, the state of each connector.
describe_all()
¶
Every notification with the state of each of its channels, as the Notifications tab shows them.
preview(type_id, channel, fields=None, template_text=UNSET, title=UNSET)
¶
The message of a notification on a channel, built from the fictional sample, as it would be sent. fields are the
ids to show (None: the saved ones); template_text and title are a message not saved yet (None: the catalogue's;
left out: the saved one). Saves and sends nothing. Same errors as save_setting.