Build a Slack Bot in 5 Minutes to Qualify Leads with Standard Library and Node.js
Tags: javascript, node, bots, marketing
Published: 2018-12-07 00:56:45

---
title: Build a Slack Bot in 5 Minutes to Qualify Leads with Standard Library and Node.js
published: true
description: We'll create a Slack bot that alerts your channel when a visitor enters data into a Typeform embedded on your site. Our Slack bot will flag individuals as "High priority!" if they belong to a company with over 50 employees. Our bot will also display individuals' full name, email, title, location, Linkedin, company name, number of employees in company x, the amount raised, estimated annual revenue, and company domain as seen in the example below 🤓.
tags: javascript, nodejs, bots, marketing
---
[Are you overwhelmed by hundreds of users signing up daily to use your online services?](https://medium.com/swlh/build-a-slack-bot-in-5-minutes-to-qualify-leads-from-typeform-with-standard-library-and-node-js-145e7a11cd9d) Do you need a better way to track and qualify leads? If so, look no further! Here are all the tools you'll need to help you and your team 😉.

**What We'll Build:** We'll create a Slack bot that alerts your channel when a visitor enters data into a Typeform embedded on your site. Our Slack bot will flag individuals as "High priority!" if they belong to a company with over 50 employees. Our bot will also display individuals' full name, email, title, location, Linkedin, company name, number of employees in company x, the amount raised, estimated annual revenue, and company domain as seen in the example below 🤓.

![](https://cdn-images-1.medium.com/max/1440/1*isUkfvgV4_OiHTXqCMVGSQ.png)

So… Let's get started!

##What You'll Need Beforehand
1x [Slack](https://slack.com/signin) free account
1x [Typeform](https://www.typeform.com/) free account
1x [Clearbit](https://clearbit.com/) free account
1x [Standard Library](https://stdlib.com/) free account
5x minutes (300x seconds)

*If you're not familiar with [Standard Library](https://stdlib.com/), you're in for a treat! Standard Library is turning everyone in your organization into a developer with [Code on Standard Library](https://code.stdlib.com) - an embeddable development environment for easily building APIs, webhooks, and workflow automation tasks.*

#Minute 1: Prepare Your Slack App on Slack's API Page

[Sign in to your Slack account](https://slack.com/signin) and visit your Slack Apps page at [https://api.slack.com/apps](https://api.slack.com/apps). Click on **Create New App.** You'll be presented with a modal to enter your App Name and the Development Slack Workspace you'd like to add it to. From here, click on Create App, and you'll find yourself on a **Basic Information** page.

![](https://cdn-images-1.medium.com/max/1440/1*8k1cFASIfP7x62fq9Ua1Fw.png)

Find **"Incoming Webhooks"** under the **"Features"** category on the left side menu bar, and toggle the button on to activate Incoming Webhooks.

![](https://cdn-images-1.medium.com/max/1440/1*OqJwSpGuwWN6apgU1cPMMw.png)
Toggle the Button On

![](https://cdn-images-1.medium.com/max/1440/1*P4ZWIHBU11jfhijOQu2DbQ.png)
Select Add New Webhook to Workspace.

Next, select **"Add New Webhook to Workspace"** and authorize your Slack App to post on a channel.

![](https://cdn-images-1.medium.com/max/1440/1*v_BpksCWUhShcaCwhkMBAw.png)  

Once authorized, [Slack](https://slack.com/) automatically generates a unique URL that you will use to send messages into Slack via HTTP request with a JSON payload from Clearbit. Copy and Save this URL; we will need it shortly.

![](https://cdn-images-1.medium.com/max/1440/1*lzfoG0UDOGxYBpN8LLpzpw.png)

Check to make sure that you've set up your Slack app properly. If you have, you should see a message like the one below on your Slack channel. If not, repeat this step 😉.

![](https://cdn-images-1.medium.com/max/1440/1*AB8OUN843kctTSjp-UVlxQ.png)

#Minute 2: Set Up and Deploy the Signupalertsbot API using Code on Standard Library

Now that you've set up your [Slack](https://slack.com/) app and activated incoming webhooks, you need to deploy the code that will connect [Typeform](https://www.typeform.com/), [Clearbit](https://clearbit.com/), and [Slack](https://slack.com/) via webhooks. To do this, we'll be using [Standard Library's](https://stdlib.com/) API platform and the online editor for APIs - if you're not a programmer don't worry! You won't need to write any of the code. We've provided the code for you, and it automatically handles high priority sign ups and cases where [Clearbit](https://clearbit.com/) does not have information on an email!

Head on over to [Code on Standard Library](http://stdlib.com/@janethl/src/signupalertsbot/0.0.0). If you click that link, a [template for the Signupalertsbot API will automatically open](http://stdlib.com/@janethl/src/signupalertsbot/0.0.0). If not, navigate to the **"Community API Sources"** tab and search for **"janethl/signupalertsbot".** Open to the env.json file on the left sidebar menu, and you'll find three environment variables that you'll need to fill in.

![](https://cdn-images-1.medium.com/max/1440/1*jnO-8wbXYwxXo2td-tfKBw.png)

Enter the [Slack](https://slack.com/) webhook URL from Part 1 into SLACK_WEBHOOK_URL under the dev section.

#Minute 3: Copy and Paste Your Clearbit API Key

Next, you'll want to log in, or sign up for a [free Clearbit](https://clearbit.com/) account at https://clearbit.com/.

Once signed into your Clearbit's dashboard, navigate to the API Key tab and copy the first key - the secret API key.

![](https://cdn-images-1.medium.com/max/1440/1*ASySYoq1KUWSEbJDomhGJA.png)

*Note that below your keys, Clearbit has suppression settings to exclude certain contacts from your enrichment project to satisfy GDPR.*

Now return to [Code on Standard Library](https://stdlib.com/) and populate the "CLEARBIT_API_KEY"variable inside env.json.

Finally, populate the "STDLIB_LIBRARY_TOKEN" variable by right-clicking between the two quotes and select **Insert Library Token** from the drop-down menu.

![](https://cdn-images-1.medium.com/max/1440/1*PoMF5BtXA_IYoWNT8NZLtw.png)

Now that your three environment variables are filled in, save these changes by clicking the orange **"Save"** button on the bottom right.

You are now ready to deploy your API. Return to the __main__.js file and click the green "Run" button on the bottom right.

![](https://cdn-images-1.medium.com/max/1440/1*pPtOCtgfBt_PLzU5r1umiw.png)

Once you've deployed your API onto Standard Library, you'll notice a **"Parameter Error"** because your functions/__main__.js endpoint requires two parameters. The two parameters; event_type, form_response, will be provided by Typeform. The final step is to take the **"API Endpoint URL"** for your API and set it as a webhook on [Typeform](https://www.typeform.com/).

#Minute 4: Set a Webhook on Typeform

![](https://cdn-images-1.medium.com/max/1440/1*GtXpwlsQqB5rB2J2m3P1yg.png)

Once you've logged in to [Typeform](https://www.typeform.com/), select **"New typeform"** from the dashboard. Find and select the **"Contact Form"** template.

![](https://cdn-images-1.medium.com/max/1440/1*z1JIZK6Gjcv4YUtE5MgLtA.png)

For now, let's use this template as is; you can return at any time to modify the style and questions to your liking. Select **"Integrate"** on the top menu.

![](https://cdn-images-1.medium.com/max/1440/1*MHK4AJ3nLg52h0IJDMaIyA.png) 

Navigate to the upper middle tab and select **"Integrate"** and then **"WEBHOOKS."**

Input your Standard Library API's endpoint url onto the Destination URL and toggle the **"Webhooks"** button on.

![](https://cdn-images-1.medium.com/max/1800/1*mLnq3K-NfSxhfv9jtXqzGA.png)

#Minute 5: Test Your Slack Bot
Your Slack Bot is ready to test! Select the **"View"** button on the upper right corner of your Typeform.

Input a valid e-mail to test it out and answer the sample questions. Once submitted you should get notified by your Slack bot. 🙌

![](https://cdn-images-1.medium.com/max/1440/1*NSZpiJzDC07mncLhKqOFOA.png)



#That’s it! 🤗
Thank you for taking the time to read and test this out! If you found this tutorial helpful please let me know!