Contents
Anchor | ||||
---|---|---|---|---|
|
Input
1. Credentials
- As a Bot
- Incoming webhook URL. - As a User
- User Token.
- As a Bot
2. Message
3. File(file path) (only when sending as a User)
Anchortip2 tip2
tip2 | |
tip2 |
Steps to set up Slack API
Anchor | ||||
---|---|---|---|---|
|
- Login to your Slack account (either with browser or with app).
- Open Slack Bot setup website (https://api.slack.com/).
- Start building the slack bot and put app name and slack workspace.
- App Name shows up as the “sender” when bot is sending messages. You can pick any name you want.
- List of workplaces existing under your login account will show up automatically.
- Select OAuth & Permissions and add bot token scopes.
a. Add required scopes: calls:write, files:write, incoming-webhook
- Select Incoming Webhooks and activate them. Add new webhook to your workspace.
- Click [Copy] and save the Webhook URL information.
Anchor | ||||
---|---|---|---|---|
|
7. Select OAuth & Permission and add user token scopes.
a. Requires user token scopes: files:write, chat:write
8. Install App to Workspace at the OAuth & Permissions page.
9. Save the OAuth Access Token which starts with xoxp-….
Anchor |
---|
|
|
Parameter Settings
- Sending message from Bot.
2. Sending message from User (you).
Anchor | ||||
---|---|---|---|---|
|
Return Value
- Select [Sting]
- Success: User definable (default is 0).
- Failure: Print error message but the bot will still run.