-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Slack Blocks #9
Comments
from errbot import BotPlugin
from errbot.backends.base import Identifier
from pprint import pformat
class SlackBlocks(BotPlugin):
def block(self, to: Identifier, blocks: []):
self.log.debug('blocks: %s' % pformat(blocks))
if self._bot.mode == 'slack':
self._bot.api_call('chat.postMessage', data={
'channel': to,
'as_user': True,
'attachments': [
{
"blocks": blocks
}
]
}) I made a plugin which does something like that, it takes the blocks as dictionary. Slack is a bit wonky regarding the blocks and empty strings cause issues. I'll make it a full plugin when I tested this more. The The blocks list is what Slack shows you in the blockbuilder on their site. |
@bloodywing Thank you for sharing your implementation. 👍 I finally got around to implementing this and your example was useful. |
Add support to the backend chat adapter. This feature may also require updating errbot's slack backend code.
https://api.slack.com/messaging/attachments-to-blocks
The text was updated successfully, but these errors were encountered: