Messaging Backends
django_slack_tools.slack_messages.backends.dummy.DummyBackend
Bases: BackendBase
An dummy backend that does nothing with message.
Source code in django_slack_tools/slack_messages/backends/dummy.py
send_message(*args, **kwargs)
django_slack_tools.slack_messages.backends.logging.LoggingBackend
Bases: DummyBackend
Backend that log the message rather than sending it.
Source code in django_slack_tools/slack_messages/backends/logging.py
django_slack_tools.slack_messages.backends.slack.SlackBackend
Bases: BackendBase
Backend actually sending the messages.
Source code in django_slack_tools/slack_messages/backends/slack.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 |
|
__init__(*, slack_app)
Initialize backend.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
slack_app |
App | Callable[[], App] | str
|
Slack app instance or import string. |
required |
Source code in django_slack_tools/slack_messages/backends/slack.py
send_message(message=None, *, policy=None, channel=None, header=None, body=None, raise_exception, get_permalink=False)
Send Slack message.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
message |
SlackMessage | None
|
Externally prepared message.
If not given, make one using |
None
|
policy |
SlackMessagingPolicy | None
|
Messaging policy to create message with. |
None
|
channel |
str | None
|
Channel to send message. |
None
|
header |
MessageHeader | None
|
Message header that controls how message will sent. |
None
|
body |
MessageBody | None
|
Message body describing content of the message. |
None
|
raise_exception |
bool
|
Whether to re-raise caught exception while sending messages. |
required |
get_permalink |
bool
|
Try to get the message permalink via extraneous Slack API calls. |
False
|
Returns:
Type | Description |
---|---|
SlackMessage
|
Sent Slack message. |
Source code in django_slack_tools/slack_messages/backends/slack.py
django_slack_tools.slack_messages.backends.slack.SlackRedirectBackend
Bases: SlackBackend
Inherited Slack backend with redirection to specific channels.
Source code in django_slack_tools/slack_messages/backends/slack.py
__init__(*, slack_app, redirect_channel, inform_redirect=True)
Initialize backend.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
slack_app |
App | str
|
Slack app instance or import string. |
required |
redirect_channel |
str
|
Slack channel to redirect. |
required |
inform_redirect |
bool
|
Whether to append an attachment informing that the message has been redirected.
Defaults to |
True
|