Python API¶
Notifier¶
-
class
RPA.Notifier.
Notifier
¶ Bases:
object
Notifier is a library interfacting with different notification services.
Supported services:
email
gmail
pushover
slack
telegram
twilio
Services not supported yet:
gitter
join
mailgun
pagerduty
popcornnotify
pushbullet
simplepush
statuspage
zulip
Read more at https://notifiers.readthedocs.io/en/latest/
Examples
Robot Framework
*** Settings *** Library RPA.Notifier *** Variables *** ${SLACK_WEBHOOK} https://hooks.slack.com/services/WEBHOOKDETAILS ${CHANNEL} notification-channel *** Tasks *** Lets notify Notify Slack message from robot channel=${CHANNEL} webhook_url=${SLACK_WEBHOOK}
Python
from RPA.Notifier import Notifier library = Notifier() slack_attachments = [ { "title": "attachment 1", "fallback": "liverpool logo", "image_url": "https://upload.wikimedia.org/wikipedia/fi/thumb/c/cd/Liverpool_FC-n_logo.svg/1200px-Liverpool_FC-n_logo.svg.png", } ] library.notify_slack( message='message for the Slack', channel="notification-channel", webhook_url=slack_webhook_url, attachments=slack_attachments, )
-
ROBOT_LIBRARY_DOC_FORMAT
= 'REST'¶
-
ROBOT_LIBRARY_SCOPE
= 'GLOBAL'¶
-
notify_email
(message: str = None, to: str = None, username: str = None, password: str = None, **kwargs: dict) → bool¶ Notify using email service
- Parameters
message – notification message
to – target of email message
username – email service username
password – email service password
- Returns
True is notification was success, False if not
-
notify_gmail
(message: str = None, to: str = None, username: str = None, password: str = None, **kwargs: dict) → bool¶ Notify using Gmail service
- Parameters
message – notification message
to – target of email message
username – GMail service username
password – GMail service password
- Returns
True is notification was success, False if not
-
notify_pushover
(message: str = None, user: str = None, token: str = None, **kwargs: dict) → bool¶ Notify using Pushover service
- Parameters
message – notification message
user – target user for the notification
token – service token
- Returns
True is notification was success, False if not
-
notify_slack
(message: str = None, channel: str = None, webhook_url: str = None, **kwargs: dict) → bool¶ Notify using Slack service
- Parameters
message – notification message
channel – target channel for the notification
webhook_url – Slack webhook url
- Returns
True is notification was success, False if not
-
notify_telegram
(message: str = None, chat_id: str = None, token: str = None, **kwargs: dict) → bool¶ Notify using Telegram service
- Parameters
message – notification message
chat_id – target chat id for the notification
token – service token
- Returns
True is notification was success, False if not
-
notify_twilio
(message: str = None, number_from: str = None, number_to: str = None, account_sid: str = None, token: str = None, **kwargs: dict) → bool¶ Notify using Twilio service
- Parameters
message – notification message
number_from – number where the message comes from
number_to – number where the messages goes to
account_sid – Twilio account SID
token – Twilio account token
- Returns
True is notification was success, False if not