Reputation: 8791
I'm trying to write a Slack bot following this tutorial.
But I'm not being able to add a bot user to my channel after login. These are the scopes I'm requiring. After I Allow my app to a access my channel, no bot is added with the name I specified in the app dashboard.
Route::get('/login/slack', function(){
return Socialite::with('slack')
->scopes([
'bot',
'channels:read',
'channels:write',
'chat:write:bot'
])
->redirect();
});
And this is my redirect function:
Route::post('/slack', function(\Illuminate\Http\Request $request)
{
$payload = $request->all();
if ( isset($payload['type']) && isset($payload['challenge']) )
{
if ($payload['type'] == 'url_verification')
{
return $payload['challenge'];
}
}
$slackbot = new SlackBot();
$slackbot = SlackBot::initialize('xoxb-XXX');
// give the bot something to listen for.
$slackbot->hears('hello', function (SlackBot $bot, $message) {
$bot->reply('Hello yourself.');
});
// Bot logic will be placed here
});
So, how can I add the bot to my channel through the api?
Upvotes: 0
Views: 608
Reputation: 32697
It is not possible to add a bot user through the API.
Bot users can be added only with one of two apporaches:
See the documentation for details.
Upvotes: 3