bootdesk/chat-sdk

TelnyxAdapter
in package
implements Adapter, HandlesSlashCommands, HandlesStatuses

Table of Contents

Interfaces

Adapter
HandlesSlashCommands
HandlesStatuses

Constants

ADAPTER_NAME  : mixed = 'telnyx-chat-sdk-php'
ADAPTER_VERSION  : mixed = '0.2.5'
USER_AGENT  : mixed = self::ADAPTER_NAME . '/' . self::ADAPTER_VERSION

Properties

$agentId  : string|null
$apiKey  : string
$apiUrl  : string
$disableAttributionTags  : bool
$extraTags  : array<string|int, mixed>
$fileUploadConverter  : FileUploadConverter
$formatConverter  : TelnyxFormatConverter
$fromNumber  : string|null
$httpClient  : ClientInterface
$messagingProfileId  : string|null
$psrFactory  : Psr17Factory|null
$webhookVerifier  : TelnyxWebhookVerifier|null

Methods

__construct()  : mixed
addReaction()  : void
channelIdFromThreadId()  : string
createResponse()  : ResponseInterface|null
decodeThreadId()  : mixed
deleteMessage()  : void
disconnect()  : void
editMessage()  : SentMessage
encodeThreadId()  : string
fetchChannelInfo()  : ChannelInfo|null
fetchMessages()  : FetchResult
fetchThread()  : ThreadInfo
getBotUserId()  : string|null
getFormatConverter()  : FormatConverter|null
getName()  : string
getUser()  : UserInfo|null
initialize()  : void
openDM()  : 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
apiCall()  : array<string|int, mixed>
buildRcsCardContent()  : array<string|int, mixed>
buildSmsParams()  : array<string|int, mixed>
parseRcsMessage()  : Message
parseSmsMessage()  : Message
sendRcs()  : array<string|int, mixed>
sendRcsContent()  : array<string|int, mixed>
sendSms()  : array<string|int, mixed>
buildTags()  : array<string|int, mixed>

Constants

ADAPTER_NAME

private mixed ADAPTER_NAME = 'telnyx-chat-sdk-php'

USER_AGENT

private mixed USER_AGENT = self::ADAPTER_NAME . '/' . self::ADAPTER_VERSION

Properties

$apiUrl read-only

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

$disableAttributionTags read-only

protected bool $disableAttributionTags = false

$extraTags read-only

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

$fromNumber read-only

protected string|null $fromNumber = null

$messagingProfileId read-only

protected string|null $messagingProfileId = null

$psrFactory read-only

protected Psr17Factory|null $psrFactory = null

Methods

__construct()

public __construct(string $apiKey, ClientInterface $httpClient[, string|null $messagingProfileId = null ][, string|null $publicKey = null ][, string|null $fromNumber = null ][, string|null $agentId = null ][, string $apiUrl = 'https://api.telnyx.com/v2/' ][, Psr17Factory|null $psrFactory = null ][, FileUploadConverter|null $fileUploadConverter = null ][, array<string|int, mixed> $extraTags = [] ][, bool $disableAttributionTags = false ]) : mixed
Parameters
$apiKey : string
$httpClient : ClientInterface
$messagingProfileId : string|null = null
$publicKey : string|null = null
$fromNumber : string|null = null
$agentId : string|null = null
$apiUrl : string = 'https://api.telnyx.com/v2/'
$psrFactory : Psr17Factory|null = null
$fileUploadConverter : FileUploadConverter|null = null
$extraTags : array<string|int, mixed> = []
$disableAttributionTags : bool = false

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

openDM()

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

apiCall()

protected apiCall(string $endpoint, array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
$endpoint : string
$params : array<string|int, mixed>
Return values
array<string|int, mixed>

buildRcsCardContent()

protected buildRcsCardContent(Card $card) : array<string|int, mixed>
Parameters
$card : Card
Return values
array<string|int, mixed>

parseRcsMessage()

protected parseRcsMessage(array<string|int, mixed> $p, string $rawBody) : Message
Parameters
$p : array<string|int, mixed>
$rawBody : string
Return values
Message

parseSmsMessage()

protected parseSmsMessage(array<string|int, mixed> $p, string $rawBody) : Message
Parameters
$p : array<string|int, mixed>
$rawBody : string
Return values
Message

sendRcsContent()

protected sendRcsContent(string $to, string $messagingProfileId, array<string|int, mixed> $content[, string|null $fallbackText = null ][, array<string|int, mixed> $attachmentUrls = [] ][, bool $first = false ]) : array<string|int, mixed>
Parameters
$to : string
$messagingProfileId : string
$content : array<string|int, mixed>
$fallbackText : string|null = null
$attachmentUrls : array<string|int, mixed> = []
$first : bool = false
Return values
array<string|int, mixed>

sendSms()

protected sendSms(string $from, string $to, PostableMessage $message) : array<string|int, mixed>
Parameters
$from : string
$to : string
$message : PostableMessage
Return values
array<string|int, mixed>

buildTags()

private buildTags() : array<string|int, mixed>
Return values
array<string|int, mixed>
On this page

Search results