- api.slack.com
Create New App
->From scratch
- Fill
App Name
and pick a workspace
Select the new app from the dropdown on the left
- Click
OAuth & Permissions
on the left - Under
Bot Token Scopes
, clickAdd an OAuth Scope
Grant the following permissions:
chat:write
chat:write.public
chat:write:customize
Click Install App
on the left and follow the on-screen instructions.
The OAuth Tokens for Your Workspace
is then shown on the page. It looks like this:
xoxb-1234567890-...-...
You can also get the token from OAuth & Permissions
on the left (section OAuth Tokens for Your Workspace
, Bot User OAuth Token
).
- Open on the channel you want to post to in Slack
- Click on the channel name (top section)
- Copy the Channel ID (shown at the bottom of the modal window)
- copy the variables to your local
.env
file. - assign the token and channel ID values to the variables
You can now send a message with
$messenger->sendMessageToChannel($messageText)`