I want to create a basic bot for Slack that can search through my Airtable database. The functionality should be pretty straightforward - when someone types a search term, the bot should look for that term in column A of my Airtable base and return whatever value is in column B for that row.
I’m also thinking it could work as a slash command, something like /lookup [search_term], where the bot would check Airtable and give back the matching result from the second column.
I don’t need anything fancy with natural language processing right now, just a simple search and return system. Has anyone built something similar before? I’d really appreciate any guidance or code examples you might have.
We built this exact same thing for our inventory lookup about 6 months ago. Wish someone had warned me upfront - you need to handle Slack’s 3 second timeout properly.
Slack throws an error if you don’t respond within 3 seconds. Since Airtable calls can run longer (especially with big bases), respond immediately with “Searching…” then use response_url to send the actual results.
For search logic, I used Airtable’s filterByFormula with FIND instead of fetching everything locally. Way more efficient: filterByFormula=FIND('${searchTerm}', {Column A}) > 0.
Set up error handling for no matches too. Users will search for stuff that doesn’t exist, so have a “No results found” message ready.
Took me 4-5 hours including testing. Pretty smooth once you nail the webhook setup.
I built something almost identical last year for our team’s knowledge base. Pretty straightforward - you need a Slack app with slash commands connected to Airtable’s REST API. The biggest pain point was Airtable’s rate limits, especially if your team searches a lot. I threw together a simple cache that holds recent queries for 10 minutes, which made everything way faster. I used Node.js with Express to catch the slash command webhook from Slack, then fired GET requests to Airtable’s API. Heads up - Airtable’s search isn’t case-sensitive, but you’ll probably want fuzzy matching since people make typos. Got it working over a weekend.