If your organization relies on Slack to connect distributed teams together, you can greatly enhance their productivity by extending the functionality of your team’s most frequently used applications. The best way to achieve this is with Slackbot integrations: microapps that let you introduce new features to Slack, fetch data from other applications, and automate manual tasks.
While there are a great variety of useful Slackbots ready to be installed, a mature organization will eventually need to build their own and integrate with custom endpoints. Integrating with a custom Slackbot is easier said than done, often inhibiting the introduction of critical time-saving features. An iPaaS greatly mitigates this obstacle, offering the infrastructure to help you easily integrate with custom Slackbots to send and retrieve data between Slack and any other application on your stack.
In this in-depth tutorial, we’ll show you how to set up and configure a reproducible connection to Slack; build your first custom Slackbot; and get started setting up an integration flow with your bot. For this example scenario, we’ll build a Slackbot that allows people in your organization (such as the sales team) to request and obtain customer information from Salesforce on a Slack channel.
Prerequisite: Sign up for a free Celigo integrator.io account
This tutorial assumes that you are using an iPaaS in order to integrate with custom Slackbots. Fortunately, you can sign up for Celigo integrator.io for free. You’ll get the full features of our platform for 30 days, and you can perpetually use our Free Edition account to tweak your integration flow. Sign up at the link below, and you can follow the rest of the steps in this tutorial with ease.
I. Set up OAuth 2.0 connection to Slack
A. Set up a Slack connection
Start establishing a connection to Slack in either of the following ways:
From the Resources menu, select Connections. Then, click + Create connection at the top right.
– or –
While working in a new or existing integration, you can add an application to a flow simply by clicking Add source or Add destination.
In the resulting Application list, select Slack.
The Create connection pane then asks you to name the new connection. Be sure to provide a clear and distinguishable Name as soon as the connection is created. Throughout integrator.io imports and exports, you will have the option to choose this new connection, and a unique identifier will prove helpful later when selecting among a list of connections that you’ve created.
Click Next to configure the connection.
B. Supply required Slack API settings
At this point, you’re presented with a series of options for providing Slack authentication.
Authentication type (required): Select OAuth 2.0 from the list. (The legacy Slack token API connection is documented separately.)
Configure scopes (required): Scopes are permissions that the Slack API defines to limit the access to your account. To select the scopes for this connection,
Click the Configure scopes button.
To access all of the scopes in the API, click the » button.
– or –
Check the scopes you want to add, and click the > button.
Click Save when you’re ready to leave the editor and finish setting up your connection.
C. Edit advanced Slack settings
Before continuing, you have the opportunity to provide additional configuration information, if needed, for the Slack connection.
Borrow concurrency from (optional): Select another connection from the list. By default, all data flowing through a connection record is submitted to the respective endpoint application at the Concurrency level configured for that connection record. There are cases, however, where multiple integrator.io connections need to share the same concurrency level, and this field allows you to specify which connection you would like to borrow from. With borrowed concurrency, the data flowing through both connections will be submitted to the endpoint application together, via a shared concurrency model.
Note: Selecting another connection from the drop-down list changes the form. The concurrency level will be hidden, set to the same shared value as the other connection’s.
Concurrency level (optional): Set this field to limit the number of concurrent HTTP requests (up to 25) allowed by the connection resource at any one time, or leave this field blank to use burst mode. With burst mode, integrator.io will make HTTP requests as fast as possible, with high levels of concurrency.
D. Save and authorize
Once you have configured the Slack connection, you have a couple options for continuing:
Save and authorize – click this button to open a browser instance, log in to Slack, and verify your settings
Cancel – click to exit without saving any new changes
Once you have confirmed the connection in Slack, close the browser window to return to integrator.io. The new connection will be applied to the current source or destination app, if you created it within a flow. Otherwise, you may proceed to register the connection with an integration.
II. Build and connect a Slackbot to an integrator.io webhook listener
To get started, we will use Slack API management interface to build a Slackbot within a new Slack app. Then, we’ll create the corresponding webhook listener in integrator.io, configure the command that our sales team users will be able to use in Slack, and install the Slack app to the workspace to make it available to them.
A. Build a Slackbot
Open the Slack API management interface.
Click Click New App. For App Name, enter Get customer details.
Confirm the workspace is correct and click Create App.Many settings and features are available for the new app. Our next step in the Slackbot configuration is to create the /getcustomer command that our salespeople will enter in Slack when they want to retrieve customer details. We’ll need a Request URL for that command, so we’ll switch over to integrator.io first and create a Slack webhook listener as the first step in our flow. Since integrator.io will need a Signing Secret from Slack, we’ll take a moment to copy that value to the clipboard.
Under the Basic information settings, locate the Signing Secret. Click Show to display the value. Then copy it to the clipboard.
B. Build a new flow with a Slack webhook listener
In integrator.io, we’ll start by building a new flow with a webhook listener to receive the request from the Slackbot.
In integrator.io, navigate to Flow Builder and click Add source.
On the Create source page, select Slack from the application list. Then, under What would you like to do? select Listen for real-time data from source application.
On the Create listener page, enter a Name and Description.
Next, paste the Signing Secret.
Click Generate URL. When the new URL appears, click Copy URL.
Click Save & close.
The new flow appears with the Slack listener displayed. Click New flow at the top of the page and change it to a meaningful name, such as Slack – Salesforce customer details.
C. Configure the /getcustomer command for the Slackbot
Now, we return to the Slackbot configuration to configure the command our sales team will use.
Navigate to Slash Commands and click Create New Command.
Create the command with the following configuration:
Command – /getcustomer
Request URL – The Public URL copied from the integrator.io listener configuration.
Short Description – Send company name to integrator.io to retrieve details.
Usage Hint – [company name] When our sales team users start entering the command in Slack, they’ll see a popup that reminds them to enter a portion of the company’s name as a search term.
Click Save.The new command appears in the list. Because Slack will automatically create a bot user, no additional configuration steps are required here.
D. Install the Slack app to your workspace
To connect the app to the workspace where our sales team communicates and enable them to use the Slackbot, we need to install the app.
Navigate to the Basic Information settings and click Install to Workspace.
Click Allow to authorize the app’s access to the workspace:
Slack then displays the OAuth token for the newly created bot user.
What to expect next
Once you’ve successfully built a Slackbot and configured your connection to retrieve data from Slack, you’re ready to move onto the next steps. Next time, we’ll show you how to create a lookup to retrieve data, establish the import step with Salesforce, and configure the results. Until then, you can check out which APIs are available on our Slack connector in integrator.io and think about what kinds of Slackbots you could build for your organization. See you soon!