Skip to content
This repository has been archived by the owner on Jul 3, 2020. It is now read-only.

Can't send messages with blocks #163

Open
hiroki-tagami opened this issue Mar 23, 2020 · 1 comment
Open

Can't send messages with blocks #163

hiroki-tagami opened this issue Mar 23, 2020 · 1 comment

Comments

@hiroki-tagami
Copy link

hiroki-tagami commented Mar 23, 2020

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?

@Martian-II
Copy link

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants