Adding Slack Blocks into a workflow using the UI

19 Views Asked by At

I have created a workflow which captures the data sent by a request in a variable, lets call it blocks.

I am using Python to hit the endpoint.

The JSON structure is as follows:

slack_data = {
        "userEmail": f"{email}",
        "blocks": [
                {
                    "type": "section",
                    "text": {
                        "type": "mrkdwn",
                        "text": f"Hello <@{user_id}>, blah blah"
                    }
                },
                {
                    "type": "divider"
                }
            ]
    }

I then compile my JSON and send it as data to my request:

response = requests.post(
     webhook_url, data=json.dumps(slack_data),
     headers={'Content-Type': 'application/json'}
)

I then get 400 errors. The URL is correct, as if I remove the slack blocks, the request goes through as expected. I have referenced the blocks variable in the workflow UI, still no joy.

webhook config

message config

Are blocks not viable when sending through a workflow, or is it only via the incoming-webhook app?

0

There are 0 best solutions below