os/slacker

Can't send messages with blocks

hiroki-tagami opened this issue · 1 comments

This code results in an error.

from slacker import Slacker

slack = Slacker("token")

blocks = [
            {
                "type": "section",
                "text": {
                    "type": "mrkdwn",
                    "text": "Start <https://google.com|Show> | <https://google.com|Cancel>"
                }
            },
        ]

slack.chat.post_message('#channnel-name', blocks=blocks)

Upon investigation, the block is not json-encoded.

Is it OK to send the modified PR?

Hi
The block must be JSON data.
Try blocks = json.dumps(blocks) .