Enable sending ephemeral messages to Slack

This commit is contained in:
Deon George 2022-09-02 17:39:49 +10:00
parent 80c1768534
commit e9a4eae7d1
1 changed files with 15 additions and 0 deletions

View File

@ -33,6 +33,7 @@ final class API
private const scopes = [
'auth.test'=>'', // No scope required
'chat.delete'=>'chat:write',
'chat.postEphemeral'=>'chat:write',
'chat.postMessage'=>'chat:write',
'chat.update'=>'chat:write',
'conversations.history'=>'channels:history', // Also need groups:history for Private Channels and im:history for messages to the bot.
@ -216,6 +217,20 @@ final class API
return new Generic($this->execute('pins.add',json_encode(['channel'=>$channel,'timestamp'=>$timestamp])));
}
/**
* Post a Slack Message to a user as an ephemeral message
*
* @param Message $request
* @return Generic
* @throws \Exception
*/
public function postEphemeral(Message $request): Generic
{
Log::debug(sprintf('%s:Post a Slack Ephemeral Message',static::LOGKEY),['m'=>__METHOD__,'r'=>$request]);
return new Generic($this->execute('chat.postEphemeral',json_encode($request)));
}
/**
* Post a Slack Message
*