Create Slackbot for Airtable Lookup


#1

Has anyone figured out how to create a Slackbot that can query Airtable via API?

Our first use-case is a glossary. We’d like to create a database of internal acronyms and industry jargon, that can be searched via Slack.

It’s my understanding that the Slack dev team has built such a bot for their internal use, but assume that their glossary dataset is not an Airtable base.

We’ve looked at tools like Howdy’s Botkit, and API.AI, but neither plays nice with Airtable out of the box… A Zapier workflow would be ideal, but we’re open to any solve that does not require custom code.

Thanks in advance!


#2

This, in theory, is as simple as:

Slack Message > Bot > Search: Airtable Base/Table 1/Field A > Return: Airtable Base/Table 1/Field B > Bot > Slack Message

It’s the Return B part I can’t seem to get with Zapier. And it’s not nearly fast enough.

A.


Dialogflow / API.AI integration with Airtable
#3

I have!

I’ve got it working both using this python package and by connecting it to API.ai using a webhook which then queries Airtable using the same python method we built.

You basically set it up using the requests library.

def get_video_record_endpoints(view):
    fields = ["Name","Latest Cut"]
    params = {"api_key": api_key, "view": view }

    r = requests.get(atVideos,params)
    json_data = json.loads(r.text)
    records_array = json_data["records"]
    
    video_endpoint_dict = {}
    for video in records_array:
        record_endpoint = video["id"]
        projectinfo_dict = video["fields"]
        video_endpoint_dict[projectinfo_dict["Name"]] = record_endpoint
        
    return video_endpoint_dict

As for speed, for some reason doing the request on Heroku instead of from my fiber connection makes it go much faster. I’m talking 500 ms from Heroku vs 2-3 seconds on our fiber connection.

API.ai is very cool and easy to connect with Slack.

This is the tutorial I used for the most part:


#4

I am trying to get Airtable to work with Dialogflow. The video in this post seems to not work any more… Can someone help?