# Notification Tasks
Collection of tasks for sending notifications.
Useful for situations in which state handlers are inappropriate.
# EmailTask
class
prefect.tasks.notifications.email_task.EmailTask
(subject=None, msg=None, email_to=None, email_from="notifications@prefect.io", smtp_server="smtp.gmail.com", smtp_port=465, smtp_type="SSL", **kwargs)[source]Task for sending email from an authenticated email service over SMTP. For this task to function properly, you must have the "EMAIL_USERNAME"
and "EMAIL_PASSWORD"
Prefect Secrets set. It is recommended you use a Google App Password if you use Gmail. The default SMTP server is set to the Gmail SMTP server on port 465 (SMTP-over-SSL)
Args:
subject (str, optional)
: the subject of the email; can also be provided at runtimemsg (str, optional)
: the contents of the email; can also be provided at runtimeemail_to (str, optional)
: the destination email address to send the message to; can also be provided at runtimeemail_from (str, optional)
: the email address to send from; defaults to notifications@prefect.iosmtp_server (str, optional)
: the hostname of the SMTP server; defaults to smtp.gmail.comsmtp_port (int, optional)
: the port number of the SMTP server; defaults to 465smtp_type (str, optional)
: either SSL or STARTTLS; defaults to SSL**kwargs (Any, optional)
: additional keyword arguments to pass to the base Task initialization
methods: |
---|
prefect.tasks.notifications.email_task.EmailTask.run (subject=None, msg=None, email_to=None, email_from=None, smtp_server=None, smtp_port=None, smtp_type=None)[source] |
Run method which sends an email.
|
# SlackTask
class
prefect.tasks.notifications.slack_task.SlackTask
(message=None, webhook_secret="SLACK_WEBHOOK_URL", **kwargs)[source]Task for sending a message via Slack. For this task to function properly, you must have a Prefect Secret set which stores your Slack webhook URL. For installing the Prefect App, please see these installation instructions.
Args:
message (str, optional)
: the message to send; can also be provided at runtimewebhook_secret (str, optional)
: the name of the Prefect Secret which stores your slack webhook URL; defaults to"SLACK_WEBHOOK_URL"
**kwargs (Any, optional)
: additional keyword arguments to pass to the base Task initialization
methods: |
---|
prefect.tasks.notifications.slack_task.SlackTask.run (message=None)[source] |
Run method which sends a Slack message.
|
# PushbulletTask
Task for sending a notification to a mobile phone (or other device) using pushbullet. For this task to function properly, you must have the "PUSHBULLET_TOKEN"
Prefect Secret set. You can set up a pushbullet account and/or get a token here: https://www.pushbullet.com/#settings/account
Args:
msg(str, optional)
: The message you want to send to your phone; can also be provided at runtime.**kwargs (Any, optional)
: additional keyword arguments to pass to the standard Task init method
methods: |
---|
prefect.tasks.notifications.pushbullet_task.PushbulletTask.run (msg=None, access_token=None)[source] |
Run method for this Task. Invoked by calling this Task after initialization within a Flow context, or by using
Returns:
|
This documentation was auto-generated from commit n/a
on May 14, 2020 at 21:12 UTC