From fef8a28c04baea7fb1157692440443ea9812425c Mon Sep 17 00:00:00 2001 From: AntoinePrv Date: Sun, 3 Jun 2018 18:05:27 +0200 Subject: [PATCH 1/2] Add other args for slack backend --- ntfy/backends/slack.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ntfy/backends/slack.py b/ntfy/backends/slack.py index bc59865..3a4e96a 100644 --- a/ntfy/backends/slack.py +++ b/ntfy/backends/slack.py @@ -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) From b1a821f237d2fca0248ae0daed27d614e42ffb3f Mon Sep 17 00:00:00 2001 From: AntoinePrv Date: Sun, 3 Jun 2018 18:12:59 +0200 Subject: [PATCH 2/2] Corrected Readme for Slack api. --- README.rst | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index fbe85f7..2fe8412 100644 --- a/README.rst +++ b/README.rst @@ -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 `_ - ``insta`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~