Vittorio
Vittorio

Reputation: 1

Slack Block checkboxes

i'am using slack block in a channel using python and webhook. Messages are sent and arrived perfectly, the messages contains text and also checkboxes. When user check a checkbox only that user can see the checked checboxes and not all other user in the channel. Is it possible for all users to see the selected checkbox?

Thank you

This is my code for build the

checkbox = []
            checkbox.append({
            "type": "input",
            "element": {
                "type": "checkboxes",
                "options": [
                    {
                        "text": {
                            "type": "plain_text",
                            "text": "Caricati {} {} di {}".format(
                                r.qta_caricata, r.articolo.um_elementare,
                                r.articolo.as_id),
                            "emoji": True
                        },
                        "value": "value-0"
                    }
                ],
                "action_id": "checkboxes-action"
            },
            "label": {
                "type": "plain_text",
                "text": " ",
                "emoji": True
            }
        })
    slack_data = {
        "username": usr,
        "icon_emoji": icon_emoji,
        "text": preview,
        "blocks": checkbox
    }
byte_length = str(sys.getsizeof(slack_data))
headers = {'Content-Type': "application/json",
           'Content-Length': byte_length}
response = requests.post(wh_url, data=json.dumps(slack_data),
                         headers=headers)

Upvotes: 0

Views: 1280

Answers (1)

Suyash Gaur
Suyash Gaur

Reputation: 2891

Understanding the problem
When user makes changes to the message, those changes are at Client Side, and hence does not reflect on other users view.

Solution
Capture the client's interactivity (check/uncheck of the checkbox), and update the message using Slack APIs from server side.

In your given scenario, you are using web-hooks for posting messages.
Web-hooks are used for one-way communication and therefore, the event of user checking/unchecking the box can't be captured and can't be updated.

Upvotes: 1

Related Questions