Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,13 @@ Requires extras, install like this: ``pip install ntfy[slack]``.

Required parameter:
* ``token`` - The Slack service secret token, created in https://api.slack.com/web#authentication
* ``recipient`` - The Slack channel or user to send notifications to. If you use the ``#`` symbol the message is send to a Slack channel and if you use the ``@`` symbol the message is send to a Slack user.
* ``recipient`` - The Slack channel or user to send notifications to. If you use the ``#`` symbol the message is send to a Slack channel. To send to a Slack user, copy hi `ID` from his profile on Slack.

Optional parameters:
* ``username`` - The name that will be used in Slack to send the message
* ``icon_url`` or ``icon_emoji`` - The profile picture/ emoji used by Slack to send the message
* ``mrkdwn`` - Set markdown parsing by Slack (defaults to True)
* other arguments from https://api.slack.com/methods/chat.postMessage

`Instapush <https://instapush.im/>`_ - ``insta``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
5 changes: 3 additions & 2 deletions ntfy/backends/slack.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from slacker import Slacker


def notify(title, message, token, recipient, retcode=None):
def notify(title, message, token, recipient, retcode=None, **kwargs):
kwargs.setdefault("username", title)

slack = Slacker(token)

slack.chat.post_message(recipient, message)
slack.chat.post_message(recipient, message, **kwargs)