A simple wrapper around the Slack web api to post messages
Simple wrapper around the Slack Web API to post messages.
webhook_url should be in the following format: 'https://hooks.slack.com/services/TEAM_ID/BOT_OR_CHANNEL_ID/AUTH_TOKEN'
from slackelot import send_message webhook_url = 'https://hooks.slack.com/services/TXXXXXXXX/BXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXXXX' message = 'Who wants to push the pram?\n@lancelot @percival' pretext = 'Knights of the Round Table' title = 'Spamelot' author_name = 'Arthur' color = '#663399' send_message(message, webhook_url, pretext=pretext, title=title, author_name=author_name, color=color)
Paid teams have the option to mention other subteams, (ie. channel). In that case, you might append something like this to your message:
'\n<!subteam^ID|HANDLE>' (replace ID and HANDLE with your subteam’s id and name, respectively).
For more information on message formatting, see the Slack API docs