barterakp.blogg.se

Slack bots
Slack bots












slack bots

The RTM API allows a bot to establish a websocket connection to the Slack API through which it receives an ongoing stream of messages that it is privy to (just like any other user does via whatever Slack client they use). One of my users asked for this as a feature, so that they could interact with the Bot without always spamming other users. The Web API can’t read or respond to direct messages.

slack bots

Also you could potentially monitor all channels by using the Web API to get a list of them, but as the message history of channels can be large, I was skeptical about how well this would scale for a busy Slack account. This is fine if you want the Bot to only be present in specific channels. I had to specify which Channel/s to monitor for messages.This was fine to a point, but apart from feeling like a misuse of the API it also had a few limitations: I used the PSSlack module by Warren F to repeatedly read the message history of a slack Channel, monitoring for messages directed to the name of my bot and responding when appropriate. I actually got a workable solution implemented with the Web API, but it felt a little like bastardisation when using it to author a bot. To learn more about the how and the why, read on below. The full code for this project can be found here in GitHub where I warmly welcome contributions. There are lots of community frameworks for working with the Slack APIs in a variety of languages, but for PowerShell existing options seemed to be limited to the Web API. Slack has three APIs: The Web API, The Events API and the RTM API. This post details how PowerShell can be used to run a custom Slack Bot that utilises the Slack RTM (Real Time Messaging) API.įollowing on from my previous post where I set up a Slack Slash Command using Azure Functions, I wanted to provide more functionality to my team via a single multi function Slack Bot.














Slack bots