Oct 04, 2023 08:55 AM
Hey Airtable enthusiasts!
I've developed a script called `slackblocks-4-airtable` that might interest those of you looking to step up your Slack notification game from Airtable. This script allows you to craft well-structured and visually appealing messages seamlessly from your Airtable base to Slack. It’s designed to make your notifications more engaging and informative.
1. Easy Setup:
Copy and paste the script into an Airtable script automation.
2. Design Your Message:
Create an array variable to contain your message, utilizing the `$.{blockType}` syntax to design your message.
3. Build and Send:
Use `$.build(message)` to assemble your message and send it via your Slack Webhook URL.
Here's a snippet of how you can instantiate the `SlackBuilder` class and send a message:
// replace 'webhook_url_here' with your webhook URL
const $ = new SlackBuilder('webhook_url_here');
const slackMessage = [
$.header("This is a header message"),
$.divider(),
$.mrkdwn("You can _even_ input *Markdown* and include <github.com|links>")
];
$.build(slackMessage).send();
You can find the script and a detailed walkthrough on how to set it up on the GitHub repository. There’s also a section on how to test your messages using Slack's Block Kit Builder before sending them to a live channel.
I hope you find `slackblocks-4-airtable` useful for your projects. I'm open to feedback and contributions to improve the script, and I'll keep adding more as I can. Feel free to fork the project, open a pull request, or share any ideas on improving this script.
Happy messaging!
Oct 04, 2023 04:43 PM - edited Oct 04, 2023 04:44 PM
Thanks for sharing. Can you maybe clarify and showcase how messages look like?
This script allows you to craft well-structured and visually appealing messages seamlessly from your Airtable base to Slack. It’s designed to make your notifications more engaging and informative.Happy messaging!
Oct 05, 2023 12:08 AM
Hey Jonathan,
Sure thing, here's the example I included in the script so that you can see the final result
I've tried to make it fairly simple for the type of element you want to make i.e. $header() for a header or $.mrkdwn for markdown text and also $.image for images, some require a few extra parameters but they should come up in IntelliSense on the airtable scripts
Oct 08, 2023 06:46 PM
That's awesome, thanks for sharing!