Question

How to send Slack Block Code through Zapier?

  • 16 November 2021
  • 6 replies
  • 1167 views

Hello,

I want to take advantage of Slack Block Kit Builder and add some buttons to my Slack messages that are generated through Zapier.

This is probably something obvious but I coudln’t find any info on this. How to I actually send those Slack messages which are Json blocks through Zapier so that they’re parsed in slack instead of showing up as a message?


This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

6 replies

Userlevel 7
Badge +14

Hi @Arek 

The Webhooks app or Code app can be used.

Webhooks: https://zapier.com/apps/webhook/help

Code: https://zapier.com/apps/code/help

Hi,

I want to refresh the topic, because it focused on links and i have a problem with send simple block message to slack with data from Google Sheet.

 

I want to send simple message with “sections” filled with values from Google Sheet cells:

{
"blocks": [
{
"type": "divider"
},
{
"type": "section",
"text": {
"type": "plain_text",
"text": "[VALUE FROM GOOGLE SHEET CELL]",
"emoji": true
}
},
{
"type": "section",
"fields": [
{
"type": "plain_text",
"text": "*[VALUE FROM GOOGLE SHEET CELL]*",
"emoji": true
},
{
"type": "plain_text",
"text": "*[VALUE FROM GOOGLE SHEET CELL]*",
"emoji": true
}
]
}
]
}

How I can do this by Zapier?

Userlevel 7
Badge +14

Hi @Jordan Humanloop 

Good question.

 

Perhaps as an alternative to buttons you can use links: https://zapier.com/help/doc/tips-formatting-your-slack-messages#links

Links

URL links are automatically hyperlinked in Slack without additional formatting.

To display link text instead of the URL:

  • Type an open angle bracket (<), your URL link, a pipe character (|), your link text, and a closing angle bracket.
    <https://zapier.com|Link text>

 

Depending on your requirements you can look into using the Slack Workflow Builder: https://slack.com/help/articles/360035692513-Guide-to-Workflow-Builder

 

Otherwise, at this time, Slack buttons in messages require specific JSON structures to render correctly, so those would require use of the Slack Block Kit via the Slack API: https://api.slack.com/reference/block-kit/blocks

 

Is there really no other way?  Having to use a completely custom Code action makes this impractical. All I want is to be able to create buttons in the slack message. Ultimately I want to offer this as a user template, but forcing a user to set up auth in the code block for slack is impractical.

Userlevel 7
Badge +9

Hey @Suren H just checking in to see how you made out here! Were you able to get things working using some of Troy’s suggestions? Let us know!

Userlevel 7
Badge +14

Hi @Suren H 

You’ll need to use the Webhooks app in your Zap: https://zapier.com/apps/webhook/integrations

OR

You can try using a Code step: https://zapier.com/apps/code/help