bootdesk/chat-sdk

WebAdapter
in package
implements Adapter, HandlesActions, HandlesSlashCommands, HasAuthorInfo

Table of Contents

Interfaces

Adapter
HandlesActions
HandlesSlashCommands
HasAuthorInfo

Properties

$accumulatedEvents  : array<string|int, mixed>
$asyncMode  : bool
$botUserId  : string|null
$broadcaster  : BroadcastAdapter|null
$bufferedAttachments  : array<string|int, mixed>
$bufferedReply  : string
$config  : WebAdapterConfig
$conversationId  : string|null
$currentUserId  : string
$fileUploadConverter  : FileUploadConverter
$formatConverter  : WebFormatConverter
$psrFactory  : Psr17Factory|null
$resolvedUserId  : string|null
$resolvedUserName  : string|null
$userName  : string

Methods

__construct()  : mixed
acknowledgeAction()  : ResponseInterface|null
Acknowledge the action to the platform (e.g. Telegram answerCallbackQuery).
addReaction()  : void
channelIdFromThreadId()  : string
createResponse()  : ResponseInterface
decodeThreadId()  : mixed
deleteMessage()  : void
disconnect()  : void
editMessage()  : SentMessage
encodeThreadId()  : string
fetchChannelInfo()  : ChannelInfo|null
fetchMessages()  : FetchResult
fetchThread()  : ThreadInfo
getAccumulatedEvents()  : array<string|int, mixed>
getAuthorInfo()  : Author
getBotUserId()  : string|null
getBufferedReply()  : string
getFormatConverter()  : FormatConverter|null
getName()  : string
getUser()  : UserInfo|null
hasResolvedUser()  : bool
initialize()  : void
openDM()  : 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
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
startTyping()  : void
stream()  : SentMessage|null
verifyWebhook()  : ResponseInterface|null
broadcastEvent()  : void
findLastUserMessage()  : array<string|int, mixed>|null
generateId()  : string
jsonError()  : ResponseInterface
resetState()  : void
resolveUserAndConversation()  : ResponseInterface|null
validatePayload()  : ResponseInterface|null
validateThreadIdFormat()  : void

Properties

$accumulatedEvents

protected array<string|int, mixed> $accumulatedEvents = []

$botUserId

protected string|null $botUserId = null

$bufferedAttachments

protected array<string|int, mixed> $bufferedAttachments = []

$bufferedReply

protected string $bufferedReply = ''

$conversationId

protected string|null $conversationId = null

$currentUserId

protected string $currentUserId = ''

$psrFactory read-only

protected Psr17Factory|null $psrFactory = null

$resolvedUserId

protected string|null $resolvedUserId = null

$resolvedUserName

protected string|null $resolvedUserName = null

Methods

__construct()

public __construct(string $userName[, WebAdapterConfig|string $config = new WebAdapterConfig() ][, Psr17Factory|null $psrFactory = null ][, FileUploadConverter|null $fileUploadConverter = null ][, BroadcastAdapter|null $broadcaster = null ][, bool $asyncMode = false ]) : mixed
Parameters
$userName : string
$config : WebAdapterConfig|string = new WebAdapterConfig()
$psrFactory : Psr17Factory|null = null
$fileUploadConverter : FileUploadConverter|null = null
$broadcaster : BroadcastAdapter|null = null
$asyncMode : bool = false

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
Return values
ResponseInterface

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

getAccumulatedEvents()

public getAccumulatedEvents() : array<string|int, mixed>
Return values
array<string|int, mixed>

getBotUserId()

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

getBufferedReply()

public getBufferedReply() : string
Return values
string

getName()

public getName() : string
Return values
string

hasResolvedUser()

public hasResolvedUser() : bool
Return values
bool

openDM()

public openDM(string $userId) : string|null
Parameters
$userId : string
Return values
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

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

startTyping()

public startTyping(string $threadId) : void
Parameters
$threadId : string

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

findLastUserMessage()

protected findLastUserMessage(array<string|int, mixed> $messages) : array<string|int, mixed>|null
Parameters
$messages : array<string|int, mixed>
Return values
array<string|int, mixed>|null

generateId()

protected generateId() : string
Return values
string

jsonError()

protected jsonError(int $status, string $message) : ResponseInterface
Parameters
$status : int
$message : string
Return values
ResponseInterface

resolveUserAndConversation()

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

validatePayload()

protected validatePayload(array<string|int, mixed> $payload) : ResponseInterface|null
Parameters
$payload : array<string|int, mixed>
Return values
ResponseInterface|null

validateThreadIdFormat()

protected validateThreadIdFormat(string $value, string $label) : void
Parameters
$value : string
$label : string
On this page

Search results