bootdesk/chat-sdk

SlackAdapter
in package
implements Adapter, HandlesActions, HandlesModals, HandlesOptionsLoad, HandlesReactions, HandlesSlackEvents, HandlesSlashCommands, HasAuthorInfo, SupportsDeleteMessages, SupportsEditMessages, SupportsModals

Table of Contents

Interfaces

Adapter
HandlesActions
HandlesModals
HandlesOptionsLoad
HandlesReactions
HandlesSlackEvents
HandlesSlashCommands
HasAuthorInfo
SupportsDeleteMessages
SupportsEditMessages
SupportsModals

Properties

$apiUrl  : string
$botToken  : string
$botUserId  : string|null
$formatConverter  : SlackFormatConverter
$httpClient  : ClientInterface
$psrFactory  : Psr17Factory|null
$webhookVerifier  : SlackWebhookVerifier|null

Methods

__construct()  : mixed
acknowledgeAction()  : ResponseInterface|null
Acknowledge the action to the platform (e.g. Telegram answerCallbackQuery).
addReaction()  : void
channelIdFromThreadId()  : string
createResponse()  : ResponseInterface|null
decodeThreadId()  : mixed
deleteMessage()  : void
disconnect()  : void
editMessage()  : SentMessage
encodeThreadId()  : string
fetchChannelInfo()  : ChannelInfo|null
fetchMessages()  : FetchResult
fetchThread()  : ThreadInfo
getAuthorInfo()  : Author
getBotUserId()  : string|null
getFormatConverter()  : FormatConverter|null
getName()  : string
getUser()  : UserInfo|null
initialize()  : void
openDM()  : string|null
openModal()  : array{viewId: string}|null
parseAction()  : Author, actionId: string, value: ?string, threadId: string, messageId: string, userId: string, isBot: bool, isMe: bool, triggerId: ?string, raw: mixed, callbackQueryId: ?string, originId: ?string}|null
parseAppHomeOpened()  : array{channelId: string, userId: string, raw: mixed}|null
parseAssistantContextChanged()  : array{channelId: string, threadId: string, threadTs: string, userId: string, context: mixed, raw: mixed}|null
parseAssistantThreadStarted()  : array{channelId: string, threadId: string, threadTs: string, userId: string, context: mixed, raw: mixed}|null
parseMemberJoinedChannel()  : array{channelId: string, userId: string, inviterId: ?string, raw: mixed}|null
parseModalClose()  : Author, callbackId: string, viewId: string, userId: string, contextId: ?string, raw: mixed}|null
parseModalSubmit()  : Author, callbackId: string, viewId: string, values: array, userId: string, contextId: ?string, raw: mixed}|null
parseOptionsLoad()  : Author, actionId: string, query: string, userId: string, raw: mixed}|null
parseReaction()  : Author, emoji: string, rawEmoji: string, added: bool, threadId: string, messageId: string, userId: string, raw: mixed, originId: ?string}|null
parseSlashCommand()  : Author, command: string, text: string, userId: string, isBot: bool, isMe: bool, channelId: string, triggerId: ?string, raw: mixed}|null
parseWebhook()  : Message
postMessage()  : SentMessage
removeReaction()  : void
respondToOptionsLoad()  : ResponseInterface|null
startTyping()  : void
stream()  : SentMessage|null
verifyWebhook()  : ResponseInterface|null
apiCall()  : array<string|int, mixed>
buildMessageParams()  : array<string|int, mixed>
extractAttachments()  : array<string|int, Attachment>
parseInteractivePayload()  : array<string|int, mixed>|null
parseSlackEvent()  : array<string|int, mixed>|null
uploadFile()  : string|null

Properties

$apiUrl read-only

protected string $apiUrl = 'https://slack.com/api/'

$httpClient read-only

protected ClientInterface $httpClient

$psrFactory read-only

protected Psr17Factory|null $psrFactory = null

Methods

__construct()

public __construct(string $botToken, ClientInterface $httpClient[, string|null $signingSecret = null ][, string $apiUrl = 'https://slack.com/api/' ][, Psr17Factory|null $psrFactory = null ]) : mixed
Parameters
$botToken : string
$httpClient : ClientInterface
$signingSecret : string|null = null
$apiUrl : string = 'https://slack.com/api/'
$psrFactory : Psr17Factory|null = null

acknowledgeAction()

Acknowledge the action to the platform (e.g. Telegram answerCallbackQuery).

public acknowledgeAction(string|null $callbackQueryId) : ResponseInterface|null
Parameters
$callbackQueryId : string|null
Return values
ResponseInterface|null

addReaction()

public addReaction(string $threadId, string $messageId, string $emoji) : void
Parameters
$threadId : string
$messageId : string
$emoji : string

channelIdFromThreadId()

public channelIdFromThreadId(string $threadId) : string
Parameters
$threadId : string
Return values
string

createResponse()

public createResponse() : ResponseInterface|null
Return values
ResponseInterface|null

decodeThreadId()

public decodeThreadId(string $threadId) : mixed
Parameters
$threadId : string

deleteMessage()

public deleteMessage(string $threadId, string $messageId) : void
Parameters
$threadId : string
$messageId : string

encodeThreadId()

public encodeThreadId(mixed $platformData) : string
Parameters
$platformData : mixed
Return values
string

getBotUserId()

public getBotUserId() : string|null
Return values
string|null

getName()

public getName() : string
Return values
string

openDM()

public openDM(string $userId) : string|null
Parameters
$userId : string
Return values
string|null

openModal()

public openModal(string $triggerId, Modal $modal[, string|null $contextId = null ]) : array{viewId: string}|null
Parameters
$triggerId : string
$modal : Modal
$contextId : string|null = null
Return values
array{viewId: string}|null

parseAction()

public parseAction(ServerRequestInterface $request) : Author, actionId: string, value: ?string, threadId: string, messageId: string, userId: string, isBot: bool, isMe: bool, triggerId: ?string, raw: mixed, callbackQueryId: ?string, originId: ?string}|null
Parameters
$request : ServerRequestInterface
Return values
Author, actionId: string, value: ?string, threadId: string, messageId: string, userId: string, isBot: bool, isMe: bool, triggerId: ?string, raw: mixed, callbackQueryId: ?string, originId: ?string}|null

parseAppHomeOpened()

public parseAppHomeOpened(ServerRequestInterface $request) : array{channelId: string, userId: string, raw: mixed}|null
Parameters
$request : ServerRequestInterface
Return values
array{channelId: string, userId: string, raw: mixed}|null

parseAssistantContextChanged()

public parseAssistantContextChanged(ServerRequestInterface $request) : array{channelId: string, threadId: string, threadTs: string, userId: string, context: mixed, raw: mixed}|null
Parameters
$request : ServerRequestInterface
Return values
array{channelId: string, threadId: string, threadTs: string, userId: string, context: mixed, raw: mixed}|null

parseAssistantThreadStarted()

public parseAssistantThreadStarted(ServerRequestInterface $request) : array{channelId: string, threadId: string, threadTs: string, userId: string, context: mixed, raw: mixed}|null
Parameters
$request : ServerRequestInterface
Return values
array{channelId: string, threadId: string, threadTs: string, userId: string, context: mixed, raw: mixed}|null

parseMemberJoinedChannel()

public parseMemberJoinedChannel(ServerRequestInterface $request) : array{channelId: string, userId: string, inviterId: ?string, raw: mixed}|null
Parameters
$request : ServerRequestInterface
Return values
array{channelId: string, userId: string, inviterId: ?string, raw: mixed}|null

parseModalClose()

public parseModalClose(ServerRequestInterface $request) : Author, callbackId: string, viewId: string, userId: string, contextId: ?string, raw: mixed}|null
Parameters
$request : ServerRequestInterface
Return values
Author, callbackId: string, viewId: string, userId: string, contextId: ?string, raw: mixed}|null

parseModalSubmit()

public parseModalSubmit(ServerRequestInterface $request) : Author, callbackId: string, viewId: string, values: array, userId: string, contextId: ?string, raw: mixed}|null
Parameters
$request : ServerRequestInterface
Return values
Author, callbackId: string, viewId: string, values: array, userId: string, contextId: ?string, raw: mixed}|null

parseOptionsLoad()

public parseOptionsLoad(ServerRequestInterface $request) : Author, actionId: string, query: string, userId: string, raw: mixed}|null
Parameters
$request : ServerRequestInterface
Return values
Author, actionId: string, query: string, userId: string, raw: mixed}|null

parseReaction()

public parseReaction(ServerRequestInterface $request) : Author, emoji: string, rawEmoji: string, added: bool, threadId: string, messageId: string, userId: string, raw: mixed, originId: ?string}|null
Parameters
$request : ServerRequestInterface
Return values
Author, emoji: string, rawEmoji: string, added: bool, threadId: string, messageId: string, userId: string, raw: mixed, originId: ?string}|null

parseSlashCommand()

public parseSlashCommand(ServerRequestInterface $request) : Author, command: string, text: string, userId: string, isBot: bool, isMe: bool, channelId: string, triggerId: ?string, raw: mixed}|null
Parameters
$request : ServerRequestInterface
Return values
Author, command: string, text: string, userId: string, isBot: bool, isMe: bool, channelId: string, triggerId: ?string, raw: mixed}|null

parseWebhook()

public parseWebhook(ServerRequestInterface $request) : Message
Parameters
$request : ServerRequestInterface
Return values
Message

removeReaction()

public removeReaction(string $threadId, string $messageId, string $emoji) : void
Parameters
$threadId : string
$messageId : string
$emoji : string

respondToOptionsLoad()

public respondToOptionsLoad(array<string|int, mixed>|null $options) : ResponseInterface|null
Parameters
$options : array<string|int, mixed>|null
Return values
ResponseInterface|null

startTyping()

public startTyping(string $threadId[, string|null $status = null ]) : void
Parameters
$threadId : string
$status : string|null = null

stream()

public stream(string $threadId, iterable<string|int, mixed> $textStream[, array<string|int, mixed> $options = [] ]) : SentMessage|null
Parameters
$threadId : string
$textStream : iterable<string|int, mixed>
$options : array<string|int, mixed> = []
Return values
SentMessage|null

verifyWebhook()

public verifyWebhook(ServerRequestInterface $request) : ResponseInterface|null
Parameters
$request : ServerRequestInterface
Return values
ResponseInterface|null

apiCall()

protected apiCall(string $method, array<string|int, mixed> $params[, string $contentType = 'application/json' ]) : array<string|int, mixed>
Parameters
$method : string
$params : array<string|int, mixed>
$contentType : string = 'application/json'
Return values
array<string|int, mixed>

extractAttachments()

protected extractAttachments(array<string|int, mixed> $event) : array<string|int, Attachment>
Parameters
$event : array<string|int, mixed>
Return values
array<string|int, Attachment>

parseInteractivePayload()

protected parseInteractivePayload(ServerRequestInterface $request) : array<string|int, mixed>|null
Parameters
$request : ServerRequestInterface
Return values
array<string|int, mixed>|null

parseSlackEvent()

protected parseSlackEvent(ServerRequestInterface $request, string $eventType, callable $extract) : array<string|int, mixed>|null
Parameters
$request : ServerRequestInterface
$eventType : string
$extract : callable
Return values
array<string|int, mixed>|null

uploadFile()

protected uploadFile(string $channel, FileUpload $file[, string $initialComment = '' ][, string|null $threadTs = null ]) : string|null
Parameters
$channel : string
$file : FileUpload
$initialComment : string = ''
$threadTs : string|null = null
Return values
string|null
On this page

Search results