Skip to main content
Question

Including variables in a Slack message using Airtable Script


Forum|alt.badge.img+1

Hey everyone!

This is my first post here, so forgive me if it sounds like a silly question. We’re currently working on a script to send an automated message via Slack every time a new record is created in Airtable. We’re using a script, rather than the pre-built Slack automation, as we need more advanced styling options and a button that takes you to a specific Airtable interface page.

I have just figured out how to call Name and Address values from the record in the first step of the automation, but I’d like to be able to use these values in the message itself. How do I call the Name or Address in the message part of the script, so that they appear as text?

Hope someone can help — thanks in advance!

Alan

3 replies

TheTimeSavingCo
Forum|alt.badge.img+18

I’d love to help with this but I’d need to set up a whole bunch of stuff in order to experiment and figure out how to do it; on the off chance you could invite me to a testing base with your script set up to point to a testing Slack channel, and also invite me to that testing Slack channel so I can see what gets fed through I’d be happy to try to see what I could figure out

 

Best of luck!


ScottWorld
Forum|alt.badge.img+20
  • Brainy
  • 8721 replies
  • March 17, 2025

Welcome to the community, ​@fileycatrescue!

Slack’s text formatting guide is located here.

I’m not a JavaScript expert so I can’t help you there, but if you’d like to easily accomplish this without writing any code at all, you can do this for free with Make’s Slack integrations and Make’s Airtable integrations.

If you’ve never used Make before, I’ve assembled a bunch of Make training resources in this thread. For example, here is one of the ways that you could instantly trigger a Make automation from Airtable.

Hope this helps! If you’d like to hire the best Airtable consultant to help you with anything Airtable-related, please feel free to contact me through my website: Airtable consultant — ScottWorld


Forum|alt.badge.img+1
  • New Participant
  • 2 replies
  • March 18, 2025
fileycatrescue wrote:

Hey everyone!

This is my first post here, so forgive me if it sounds like a silly question. We’re currently working on a script to send an automated message via Slack every time a new record is created in Airtable. We’re using a script, rather than the pre-built Slack automation, as we need more advanced styling options and a button that takes you to a specific Airtable interface page.

I have just figured out how to call Name and Address values from the record in the first step of the automation, but I’d like to be able to use these values in the message itself. How do I call the Name or Address in the message part of the script, so that they appear as text?

Hope someone can help — thanks in advance!

Alan

You can reference the Name and Address values in your Slack message by storing them in variables when retrieving the record data from Airtable. Then, use string interpolation or template literals (if using JavaScript) to insert them into the message.

For example, in JavaScript:

 

javascript

const name = record.get("Name"); const address = record.get("Address"); const message = `New record added:\n*Name:* ${name}\n*Address:* ${address}`;

Ensure your script correctly fetches the data before constructing the message


Reply