How to create a bot for your website with slack

Slackbots are handy robotic assistants that hang out in Slack, wait for commands, and then find or create what you need. You can create a Slackbot right now, in just a few minutes, without any code.

How hard will it be? It depends on what you want your bot to do.

  • Reply Bots respond when someone uses a specific phrase and are the easiest bots to create. They’re perfect for automatically responding to frequently asked questions in Slack.

  • Notification bots watch what’s happening in other apps and send any upgrade to Slack, and they’re pretty easy to do. These bots keep your team up to date with information from other apps so you don’t have to go back and forth.

  • Slash Command Bots are activated by a command that begins with a slash and are one of the most difficult bots to create. An example is /giphy, which is a command that triggers a bot to find animated GIFs. You can create similar bots that get information from other apps.

In this article, we’ll describe how to build all three types of bots with Zapier, a tool that connects apps without any code.

How to Create a Slack Reply Bot

Reply bots can save your team time by answering questions that come up over and over again. They constantly watch all Slack channels and answer for you when specific phrases are mentioned.

There are two ways to make this type of bot. The first is to set up a Slackbot response. The second, which requires a bit more setup but is much more customizable, is to build a custom bot using Zapier. Let’s dive deeper.

How to Create a Simple Slack Reply Bot with Slackbot

Slackbot replies, the easiest way to create a bot, is in Slack’s settings. Just go to slack.com/customize/slackbot, add a sentence for Slackbot to look at, and then tell it how to respond.

Here at Zapier, for example, employees frequently ask how to recommend their friends for jobs. openings, so we created a Slackbot response that answers this question.

Note that you can add as many trigger phrases as you like; just separate them with a comma, as shown above. This is what it looks like when someone uses one of those phrases:

This saves our recruiting team from having to constantly answer the same question. It’s quick to set up and works across all Slack channels.

The downside: This tool is quite limited, as you can only post the same response each time. What if you want a personalized response every time? What if you want the bot to have a custom name and icon? That’s when you’ll use Zapier.

How to Create a Custom Slack Reply Bot with Zapier

First, you’ll need to create a Zapier account or sign in to your Zapier account.

Next, click the Create a Zap button in the upper left corner and select Slack as your trigger app.

For the trigger event, choose New public message posted anywhere. Alternatively, if you want this bot to only work in one channel, you can select New message posted to channel.

See Also:  How to create a youtube channel with a different name

You will then need to connect your Slack account to Zapier by clicking Connect a new account. Once you’ve connected your account, select it from the dropdown menu and click Continue.

You’ll then be asked if you want your trigger to apply to email messages. bot. Since you’re creating a bot yourself, you’ll want to choose No and click Continue.

Then click Test Trigger so Zapier can create a test event to make sure the trigger works correctly. Once the test runs successfully, click Continue.

You will now need a filter to search for a specific term; otherwise your bot would run every time something is posted to Slack. . For your action app, choose Filter by Zapier.

In the filter settings, have it look at the Text field for the term you want.

If you want the bot to run whenever any of those words are posted to Slack, set the filter to (Text) contains. If you want it to only run when it sees that specific phrase by itself, set it to (Text) Matches Exactly. Then, in the third field, type the words you want the bot to watch for.

Now you’ll add your response, creating a basic bot. To do that, add another step to your Zap, selecting the Slack app and the Send Channel Message action. There, in the Channel field, select the channel name of your original Slack message, so that the reply ends up in the same place.

All that remains is to type the message you want to post in the Message Text box. You can write whatever you want and even tag the person who sent the original message. Scroll down and you’ll be able to add a name and icon to your bot, or have it post to Slack using your name, if you’d like.When everything looks good, you’re ready to use your Zap and send your custom message every time there’s a match.

To further customize things, you can try a Formatter action before your response. bot. Formatter is a handy tool that can format your text, calculate values, pick random values ​​from a list, and more.

Suppose you want to create a birthday bot that will send a random GIF from a list whenever someone say “Happy Birthday!” Our filter above is already looking for the right phrase: all we need now is the Select from List formatter and some GIFs.

To add the Formatter action, click Continue or button below the Filter step to add a new action. Choose the Formatter by Zapier app. Then select the Select from List formatter in the Transform field and enter the GIF links in the Input fields.

Now add another step, this time selecting Slack as your action app. Choose Send Channel Message as the action. Then, in the message text box, add your birthday message and select your random Formatter GIF from the dropdown. When this Zap is running, the next time someone says “happy birthday”, they’ll be surprised by one of your GIFs.

How to Create a Slack Notification Bot

Slack Notification Bots notification are even easier to build in Zapier. All you need is an app or site to see the notifications, and Zapier can automatically send them to Slack for you.

See Also:  Avoid boring, repetitive work by getting your computer to do it instead

Let’s say you want to get notified in Slack whenever new tasks are added to your board by Trello. First create a new Zap and select Trello as your trigger app. For your trigger action, select New Card.

Click Continue and you will be able to choose which board and list you want to receive notifications from. After this, you can format the message that your bot will send. To do that, click and add a Slack action.

Now you can configure the Zap to send a message to a channel or as a direct message to any member of your equipment. . Once you choose, you can customize the message with whatever text you want (in the Message field).

As you type, you’ll see a drop-down menu with Trello information about the card, such as your name, link, description and more; click any item in this dropdown menu to add it to your message.

You can quickly create Slack notification bots for any of the thousands of apps that connect to Zapier, or with any site that uses RSS . Here are a few that we recommend. Click the button next to a Zap you’d like to try and you can get started.

How to Build a Slack Bar Command Bot

Now you’re ready to build the most advanced bots in Slack: slash commands. They are the bots that wait for a command and then do what you ask. Create a document, find an email address, start a call, log records, whatever.

It all starts with adding a new app to your Slack account. Go to api.slack.com/apps, click Create an app, enter a name for your app, and select the correct Slack account where you want to use the new Slack bot.

Slack will display some options for adding features to your app. You can add bot users, interactive messages, and more, but each one requires coding. Instead, let’s select the Command Bar button. Click Create New Command.

First, add a command with a slash in front of it, perhaps /contact if you want to look up contact information, /weather to create a climate. bot, or whatever else suits your needs. You can then add a short description and usage hint.

There is one more field to fill in: Request URL. We’ll take that URL from the Zapier webhooks integration.

In a new tab or window, create a new Zap using the Zapier Webhooks app and select Catch Hook as the trigger event.

Click Continue and you will see the URL of your webhook. Copy it, making sure to check the Enable to reply with an empty body option as well.

With that webhook link copied, return to the previous Slack slash command settings page and paste the link into the Request URL field and then save your settings.

Now it’s time to test your forward slash command so you can build the rest of your integration with Zapier. Just open Slack and type your command followed by the text you’d like to use in the bot.

See Also:  How to Create a Logo Using Google Drawings

I’m building a bot that will find contacts in Google Contacts and send me their email address in Slack, so I’ll log in a name that you can use to search for Google Contacts.

Now it’s time to use the data. Here are some quick ideas of what your command could do:

  • Use Formatter to break your text into sections, format the text, calculate numbers, and more.

  • Use search to find information in your favorite apps—perhaps to find an entry in a spreadsheet, a contact in a CRM, a customer from your payment app, and more.There are also app searches like GIPHY that can find information online based on your query.

  • Use Zapier’s standard actions to save information to your apps, for example, to add a new contact, create a document, track time spent on a task, and more.

Let’s try using a search to find a contact from your Google Contacts account. Add an action to the Zap, select Google Contacts, and then use the Find Contact action. Have it search by name, then select your slash text as the search query.

Now that Zapier has found your contact, it’s time to send it back to Slack. Simply add another action to your Zap and select the Send Channel Message action. Instead of selecting a specific Slack channel to post, choose Custom and click the Channel ID field to find the channel.

All you need to do now is to create your message. Write whatever you want in the Message Text field, taking any information from the previous steps in the menu below the text box. Then, customize the bot, adding the same name and icon image that you added to Slack earlier.

Try Zap and you’ll get the response in Slack you wanted.

Now, whenever you need a contact, or whatever you created your bot for, just type your slash command followed by the text you need to use. Your bot will do the work for you.

How to build a chatbot with your other chat apps

You can use Zapier to build notification bots in any of the tools you use to get work made. Simply connect the app you’d like to receive notifications about, such as your CRM, support ticket tool, or to-do list app, to the team chat app you’d like to receive notifications about, such as Discord, Microsoft Teams, or Google. Chat. Here are some popular ways to create your own chatbot:

Receive notifications for tasks

Receive notifications for leads

Receive notifications of meetings and events

You can create a bot for any scenario. Want to know when team members are on call? Or when your coworkers are out of the office? The possibilities are endless.

The original version of this article was published in March 2018 by Matthew Guay. Will Harris last updated it in October 2022 to add new screenshots and instructions.

.

Leave a Reply

Your email address will not be published. Required fields are marked *