In other words, your App Home channelID is the user UserID. To send a message in your App Home you need to set the channelID as the UserID. We generate your message using our View.Slack provides only the UserID because this data may be considered sensitive. We need the actual name of our User, so we use GetUserInfo.It is specific to Socket Mode and may cause errors if you forget. You need to acknowledge that you received the message.*socketmode.Event is a generic type of event, you register that function to receive AppMentionEvent, therefore you need to convert the incoming event, so it is more convenient to handle.There are five important steps in the code snippet: We will define the core logic of our Bot in reactToMention and postGreetingMessage. Tutorial Step 2: Create the project repositoryįirst, create a new go project and import slack-go library.Įnter fullscreen mode Exit fullscreen mode users:read - In this example, I collect the user name to personalize the greeting message.chat:write - let you post messages in channels.Go to OAuth & Permissions save the Bot User OAuth Token we will need it and add the following permissions: Do not forget to save the Application token provided to you.Īctivate Event Api and subscribe to the following event: Please give it a cool name.Īctivate Socket Mode in the appropriate section. Tutorial Step 1: Configure your ApplicationĬreate a new Application. You want to convince your users that your App Home is the one place to find information about your App or Bot. Also, I personally prefer sending informative messages in the Slack App Home over sending them as a private message via a Bot. Unlike Ephemeral messages, those messages will be persisted, meaning that all the tips and tricks you send will be easily accessible. You can create a customized landing page, add an about page to document your App, and have a private message thread between your App and a user. Use Case 2: React to messages that mentioned your App or Bot with a message in your App HomeĪpp Home is a dedicated space for your Slack Application. Those are ideal for reaction to user interaction such as joining a channel, answering with sensitive information, giving instruction, etc. Use Case 1: Sending Ephemeral greeting message when a user joins a channelĮphemeral messages are visible only by a specific user and are not persisted in the conversation. Socket mode is perfect for a small application that you do not intend to distribute via App Directory In other words, your laptop, your raspberry pi, or a private server can host your bot. This tutorial guides you into implementing those two use cases I mentioned at the very beginning in Golang with the slack-go library and using Slack Socket Mode. I consider those as the basis of any Slack application. With this base setup, you will be able to create much more exciting interactions with your users. Before moving on into coding, let me showcase two use cases and explain Slack's terminology. I want this article to help you understand some core features of Slack Applications. You can also introduce the purpose and rules of a channel whenever a user joins, with a message only he can see as not to pollute other members. For instance, you can send a short tutorial on how to your App in the Slack App Home. When creating a Slack Application to increase engagement, it is essential to start small meaningful one-on-one interaction.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |