That done, you're all ready to arrange the architecture of this automaton. To use your Slack App as a bot, first you'll need to create a Bot User for it. You'll be presented with a button marked Add a Bot User, and when you click on it, you'll see a screen where you can configure your app's bot user with the following info: Head to your app's settings page and click the Bot Users feature in the navigation menu. Display name - the name that is displayed to other users when the bot posts messages, or the bot's profile is viewed, etc.Default username - the string that is used when the bot is mentioned in a message. This username may be modified slightly from the default when it is installed to a workspace where that username is already reserved. This modification is an incrementing number appended to the username - so might become Always Show My Bot as Online - we recommend you enable this feature, so that your bot always appears to be ready to receive input (which it probably will be). When disabled, you'll have to programmatically set its online presence. Once you've completed these fields, click the Add Bot User button and then Save Changes. Great, you've just created a bouncing baby bot! Don't leave the app settings yet though, there's just one more bit of configuration left to do. The Events API is a bot's equivalent of eyes and ears. It gives a bot a way to react to posted messages, changes to channels, and other activities that happen in Slack. You'll need to configure the Request URL that the data payloads will be pushed to.Switch the Enable Events toggle to on and you'll be presented with a new screen of options.From your app's settings, click the Event Subscriptions feature in the navigation menu.Giving your bot access to the Events API is pretty simple: When these events happen, a data payload will be sent to your bot, and it can use that data to form a useful response. Then you'll add some individual event subscriptions.This URL needs to be verified first, as outlined in the Events API docs. There are lots of different event types you could add, but for the purposes of our tutorial let's add two event subscriptions - app_mention which sends events when someone mentions your bot, and message.channels which sends events when a new message is posted in a public channel.For our bot, we're interested in the Bot Events, so click on the Add Bot User Event button.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |