bootdesk/chat-sdk

InstagramAdapter
in package
implements Adapter, HandlesActions, HandlesBatchedWebhooks, HandlesReactions, HandlesSlashCommands, HandlesStatuses, HasAuthorInfo

Table of Contents

Interfaces

Adapter
HandlesActions
HandlesBatchedWebhooks
HandlesReactions
HandlesSlashCommands
HandlesStatuses
HasAuthorInfo

Properties

$apiUrl  : string
$apiVersion  : string
$authMode  : string
$botUserId  : string|null
$fileUploadConverter  : FileUploadConverter
$formatConverter  : InstagramFormatConverter
$httpClient  : ClientInterface
$igAccessToken  : string|null
$igUserId  : string|null
$pageAccessToken  : string|null
$psrFactory  : Psr17Factory|null
$webhookVerifier  : InstagramWebhookVerifier

Methods

__construct()  : mixed
acknowledgeAction()  : ResponseInterface|null
Acknowledge the action to the platform (e.g. Telegram answerCallbackQuery).
addReaction()  : void
channelIdFromThreadId()  : string
createResponse()  : ResponseInterface|null
createWithIgToken()  : self
createWithPageToken()  : self
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
markSeen()  : 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
parseBatchedWebhook()  : array<string|int, WebhookEvent>
Parse ALL events from a potentially-batched webhook payload.
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
parseStatus()  : array{type: "delivered"|"read"|"failed", messageIds: string[], threadId: string, userId: string, raw: mixed, timestamp: ?int, originId: ?string}|null
parseWebhook()  : Message
postMessage()  : SentMessage
removeReaction()  : void
startTyping()  : void
stream()  : SentMessage|null
verifyWebhook()  : ResponseInterface|null
extractAttachments()  : array<string|int, Attachment>
graphApiCall()  : array<string|int, mixed>
jsonError()  : ResponseInterface
messagesEndpoint()  : string
truncate()  : string

Properties

$pageAccessToken read-only

protected string|null $pageAccessToken = null

Methods

__construct()

public __construct(ClientInterface $httpClient, string $verifyToken, string $appSecret[, string|null $pageAccessToken = null ][, string|null $igAccessToken = null ][, string|null $igUserId = null ][, string $apiVersion = 'v25.0' ][, Psr17Factory|null $psrFactory = null ][, FileUploadConverter|null $fileUploadConverter = null ]) : mixed
Parameters
$httpClient : ClientInterface
$verifyToken : string
$appSecret : string
$pageAccessToken : string|null = null
$igAccessToken : string|null = null
$igUserId : string|null = null
$apiVersion : string = 'v25.0'
$psrFactory : Psr17Factory|null = null
$fileUploadConverter : FileUploadConverter|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

createWithIgToken()

public static createWithIgToken(ClientInterface $httpClient, string $igAccessToken, string $igUserId, string $appSecret, string $verifyToken[, string $apiVersion = 'v25.0' ][, Psr17Factory|null $psrFactory = null ][, FileUploadConverter|null $fileUploadConverter = null ]) : self
Parameters
$httpClient : ClientInterface
$igAccessToken : string
$igUserId : string
$appSecret : string
$verifyToken : string
$apiVersion : string = 'v25.0'
$psrFactory : Psr17Factory|null = null
$fileUploadConverter : FileUploadConverter|null = null
Return values
self

createWithPageToken()

public static createWithPageToken(ClientInterface $httpClient, string $pageAccessToken, string $appSecret, string $verifyToken[, string $apiVersion = 'v25.0' ][, Psr17Factory|null $psrFactory = null ][, FileUploadConverter|null $fileUploadConverter = null ]) : self
Parameters
$httpClient : ClientInterface
$pageAccessToken : string
$appSecret : string
$verifyToken : string
$apiVersion : string = 'v25.0'
$psrFactory : Psr17Factory|null = null
$fileUploadConverter : FileUploadConverter|null = null
Return values
self

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

markSeen()

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

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

parseBatchedWebhook()

Parse ALL events from a potentially-batched webhook payload.

public parseBatchedWebhook(ServerRequestInterface $request) : array<string|int, WebhookEvent>

Unlike the individual parseXxx() methods which return on the first match, this method iterates every entry/event and returns all of them for the Chat to dispatch individually.

Parameters
$request : ServerRequestInterface
Return values
array<string|int, WebhookEvent>

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

parseStatus()

public parseStatus(ServerRequestInterface $request) : array{type: "delivered"|"read"|"failed", messageIds: string[], threadId: string, userId: string, raw: mixed, timestamp: ?int, originId: ?string}|null
Parameters
$request : ServerRequestInterface
Return values
array{type: "delivered"|"read"|"failed", messageIds: string[], threadId: string, userId: string, raw: mixed, timestamp: ?int, originId: ?string}|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

extractAttachments()

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

graphApiCall()

protected graphApiCall(string $endpoint, array<string|int, mixed> $params[, string $method = 'POST' ][, array<string|int, mixed> $queryParams = [] ]) : array<string|int, mixed>
Parameters
$endpoint : string
$params : array<string|int, mixed>
$method : string = 'POST'
$queryParams : array<string|int, mixed> = []
Return values
array<string|int, mixed>

jsonError()

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

messagesEndpoint()

protected messagesEndpoint() : string
Return values
string

truncate()

protected truncate(string $text[, int $limit = 1000 ]) : string
Parameters
$text : string
$limit : int = 1000
Return values
string
On this page

Search results