WebAdapter
in package
implements
Adapter, HandlesActions, HandlesSlashCommands, HasAuthorInfo
Table of Contents
Interfaces
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
= []
$asyncMode
protected
bool
$asyncMode
= false
$botUserId
protected
string|null
$botUserId
= null
$broadcaster
protected
BroadcastAdapter|null
$broadcaster
= null
$bufferedAttachments
protected
array<string|int, mixed>
$bufferedAttachments
= []
$bufferedReply
protected
string
$bufferedReply
= ''
$config read-only
protected
WebAdapterConfig
$config
$conversationId
protected
string|null
$conversationId
= null
$currentUserId
protected
string
$currentUserId
= ''
$fileUploadConverter
protected
FileUploadConverter
$fileUploadConverter
$formatConverter
protected
WebFormatConverter
$formatConverter
$psrFactory read-only
protected
Psr17Factory|null
$psrFactory
= null
$resolvedUserId
protected
string|null
$resolvedUserId
= null
$resolvedUserName
protected
string|null
$resolvedUserName
= null
$userName read-only
protected
string
$userName
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|nulladdReaction()
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
stringcreateResponse()
public
createResponse() : ResponseInterface
Return values
ResponseInterfacedecodeThreadId()
public
decodeThreadId(string $threadId) : mixed
Parameters
- $threadId : string
deleteMessage()
public
deleteMessage(string $threadId, string $messageId) : void
Parameters
- $threadId : string
- $messageId : string
disconnect()
public
disconnect() : void
editMessage()
public
editMessage(string $threadId, string $messageId, PostableMessage $message) : SentMessage
Parameters
- $threadId : string
- $messageId : string
- $message : PostableMessage
Return values
SentMessageencodeThreadId()
public
encodeThreadId(mixed $platformData) : string
Parameters
- $platformData : mixed
Return values
stringfetchChannelInfo()
public
fetchChannelInfo(string $channelId) : ChannelInfo|null
Parameters
- $channelId : string
Return values
ChannelInfo|nullfetchMessages()
public
fetchMessages(string $threadId[, FetchOptions|null $options = null ]) : FetchResult
Parameters
- $threadId : string
- $options : FetchOptions|null = null
Return values
FetchResultfetchThread()
public
fetchThread(string $threadId) : ThreadInfo
Parameters
- $threadId : string
Return values
ThreadInfogetAccumulatedEvents()
public
getAccumulatedEvents() : array<string|int, mixed>
Return values
array<string|int, mixed>getAuthorInfo()
public
getAuthorInfo(Author $author) : Author
Parameters
- $author : Author
Return values
AuthorgetBotUserId()
public
getBotUserId() : string|null
Return values
string|nullgetBufferedReply()
public
getBufferedReply() : string
Return values
stringgetFormatConverter()
public
getFormatConverter() : FormatConverter|null
Return values
FormatConverter|nullgetName()
public
getName() : string
Return values
stringgetUser()
public
getUser(string $userId) : UserInfo|null
Parameters
- $userId : string
Return values
UserInfo|nullhasResolvedUser()
public
hasResolvedUser() : bool
Return values
boolinitialize()
public
initialize(Chat $chat) : void
Parameters
- $chat : Chat
openDM()
public
openDM(string $userId) : string|null
Parameters
- $userId : string
Return values
string|nullparseAction()
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}|nullparseSlashCommand()
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}|nullparseWebhook()
public
parseWebhook(ServerRequestInterface $request) : Message
Parameters
- $request : ServerRequestInterface
Return values
MessagepostMessage()
public
postMessage(string $threadId, PostableMessage $message) : SentMessage
Parameters
- $threadId : string
- $message : PostableMessage
Return values
SentMessageremoveReaction()
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|nullverifyWebhook()
public
verifyWebhook(ServerRequestInterface $request) : ResponseInterface|null
Parameters
- $request : ServerRequestInterface
Return values
ResponseInterface|nullbroadcastEvent()
protected
broadcastEvent(BroadcastEvent $event[, string|null $targetUserId = null ]) : void
Parameters
- $event : BroadcastEvent
- $targetUserId : string|null = 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>|nullgenerateId()
protected
generateId() : string
Return values
stringjsonError()
protected
jsonError(int $status, string $message) : ResponseInterface
Parameters
- $status : int
- $message : string
Return values
ResponseInterfaceresetState()
protected
resetState() : void
resolveUserAndConversation()
protected
resolveUserAndConversation(array<string|int, mixed> $payload, ServerRequestInterface $request) : ResponseInterface|null
Parameters
- $payload : array<string|int, mixed>
- $request : ServerRequestInterface
Return values
ResponseInterface|nullvalidatePayload()
protected
validatePayload(array<string|int, mixed> $payload) : ResponseInterface|null
Parameters
- $payload : array<string|int, mixed>
Return values
ResponseInterface|nullvalidateThreadIdFormat()
protected
validateThreadIdFormat(string $value, string $label) : void
Parameters
- $value : string
- $label : string