Table of Contents
Interfaces
- Adapter
- MustRehydrateAttachments
- RequiresSyncResponse
- Marker interface for adapters that require the bot's response
within the same HTTP request.
Constants
-
API_VERSION
: mixed = '2010-04-01'
-
TWILIO_MESSAGE_LIMIT
: mixed = 1600
Properties
-
$accountSid
: string
-
$apiUrl
: string
-
$authToken
: string
-
$chat
: Chat|null
-
$formatConverter
: TwilioFormatConverter
-
$httpClient
: ClientInterface
-
$messagingServiceSid
: string|null
-
$phoneNumber
: string|null
-
$psrFactory
: Psr17Factory|null
-
$statusCallbackUrl
: string|null
-
$webhookUrl
: string|null
-
$webhookVerifier
: TwilioWebhookVerifier|null
Methods
-
__construct()
: mixed
-
addReaction()
: void
-
channelIdFromThreadId()
: string
-
createResponse()
: ResponseInterface|null
-
decodeThreadId()
: mixed
-
deleteMessage()
: void
-
disconnect()
: void
-
editMessage()
: SentMessage
-
encodeThreadId()
: string
-
fetchChannelInfo()
: ChannelInfo|null
-
fetchMedia()
: StreamInterface
-
fetchMessages()
: FetchResult
-
fetchThread()
: ThreadInfo
-
getBotUserId()
: string|null
-
getFormatConverter()
: FormatConverter|null
-
getName()
: string
-
getUser()
: UserInfo|null
-
initialize()
: void
-
openDM()
: string|null
-
parseWebhook()
: Message
-
postMessage()
: SentMessage
-
rehydrateAttachment()
: Attachment
-
removeReaction()
: void
-
startTyping()
: void
-
stream()
: SentMessage|null
-
verifyWebhook()
: ResponseInterface|null
-
apiCall()
: array<string|int, mixed>
-
attachmentType()
: string
-
mediaUrls()
: array<string|int, mixed>
-
parseDate()
: DateTimeImmutable
-
parseResource()
: Message
-
renderPostableText()
: string
-
senderFields()
: array<string|int, mixed>
-
threadIdForResource()
: string
-
compareMessageDates()
: int
API_VERSION
private
mixed
API_VERSION
= '2010-04-01'
TWILIO_MESSAGE_LIMIT
private
mixed
TWILIO_MESSAGE_LIMIT
= 1600
$accountSid
read-only
protected
string
$accountSid
$apiUrl
read-only
protected
string
$apiUrl
= 'https://api.twilio.com'
$authToken
read-only
protected
string
$authToken
$chat
protected
Chat|null
$chat
= null
protected
TwilioFormatConverter
$formatConverter
$httpClient
read-only
protected
ClientInterface
$httpClient
$messagingServiceSid
read-only
protected
string|null
$messagingServiceSid
= null
$phoneNumber
read-only
protected
string|null
$phoneNumber
= null
$psrFactory
read-only
protected
Psr17Factory|null
$psrFactory
= null
$statusCallbackUrl
read-only
protected
string|null
$statusCallbackUrl
= null
$webhookUrl
read-only
protected
string|null
$webhookUrl
= null
$webhookVerifier
protected
TwilioWebhookVerifier|null
$webhookVerifier
= null
__construct()
public
__construct(string $accountSid, string $authToken, ClientInterface $httpClient[, string|null $phoneNumber = null ][, string|null $messagingServiceSid = null ][, string|null $webhookUrl = null ][, string|null $statusCallbackUrl = null ][, Psr17Factory|null $psrFactory = null ][, string $apiUrl = 'https://api.twilio.com' ]) : mixed
Parameters
-
$accountSid
: string
-
-
$authToken
: string
-
-
$httpClient
: ClientInterface
-
-
$phoneNumber
: string|null
= null
-
-
$messagingServiceSid
: string|null
= null
-
-
$webhookUrl
: string|null
= null
-
-
$statusCallbackUrl
: string|null
= null
-
-
$psrFactory
: Psr17Factory|null
= null
-
-
$apiUrl
: string
= 'https://api.twilio.com'
-
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
-
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
-
disconnect()
public
disconnect() : void
editMessage()
public
editMessage(string $threadId, string $messageId, PostableMessage $message) : SentMessage
Parameters
-
$threadId
: string
-
-
$messageId
: string
-
-
$message
: PostableMessage
-
encodeThreadId()
public
encodeThreadId(mixed $platformData) : string
Parameters
-
$platformData
: mixed
-
fetchChannelInfo()
public
fetchChannelInfo(string $channelId) : ChannelInfo|null
Parameters
-
$channelId
: string
-
public
fetchMedia(Attachment $attachment) : StreamInterface
Parameters
-
$attachment
: Attachment
-
Return values
StreamInterface
fetchMessages()
public
fetchMessages(string $threadId[, FetchOptions|null $options = null ]) : FetchResult
Parameters
-
$threadId
: string
-
-
$options
: FetchOptions|null
= null
-
fetchThread()
public
fetchThread(string $threadId) : ThreadInfo
Parameters
-
$threadId
: string
-
getBotUserId()
public
getBotUserId() : string|null
Return values
string|null
public
getFormatConverter() : FormatConverter|null
getName()
public
getName() : string
getUser()
public
getUser(string $userId) : UserInfo|null
Parameters
-
$userId
: string
-
initialize()
public
initialize(Chat $chat) : void
Parameters
-
$chat
: Chat
-
openDM()
public
openDM(string $userId) : string|null
Parameters
-
$userId
: string
-
Return values
string|null
parseWebhook()
public
parseWebhook(ServerRequestInterface $request) : Message
Parameters
-
$request
: ServerRequestInterface
-
postMessage()
public
postMessage(string $threadId, PostableMessage $message) : SentMessage
Parameters
-
$threadId
: string
-
-
$message
: PostableMessage
-
rehydrateAttachment()
public
rehydrateAttachment(Attachment $attachment) : Attachment
Parameters
-
$attachment
: Attachment
-
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>
= []
-
verifyWebhook()
public
verifyWebhook(ServerRequestInterface $request) : ResponseInterface|null
Parameters
-
$request
: ServerRequestInterface
-
Return values
ResponseInterface|null
apiCall()
protected
apiCall(string $method, string|null $path[, array<string|int, mixed> $params = [] ][, string|null $overrideUrl = null ][, bool $returnStream = false ]) : array<string|int, mixed>
Parameters
-
$method
: string
-
-
$path
: string|null
-
-
$params
: array<string|int, mixed>
= []
-
-
$overrideUrl
: string|null
= null
-
-
$returnStream
: bool
= false
-
Return values
array<string|int, mixed>
attachmentType()
protected
attachmentType(string|null $contentType) : string
Parameters
-
$contentType
: string|null
-
protected
mediaUrls(PostableMessage $message) : array<string|int, mixed>
Parameters
-
$message
: PostableMessage
-
Return values
array<string|int, mixed>
parseDate()
protected
parseDate(string|null $value) : DateTimeImmutable
Parameters
-
$value
: string|null
-
Return values
DateTimeImmutable
parseResource()
protected
parseResource(array<string|int, mixed> $raw, array<string|int, mixed> $fallbackThread) : Message
Parameters
-
$raw
: array<string|int, mixed>
-
-
$fallbackThread
: array<string|int, mixed>
-
renderPostableText()
protected
renderPostableText(PostableMessage $message) : string
Parameters
-
$message
: PostableMessage
-
senderFields()
protected
senderFields(string $sender) : array<string|int, mixed>
Parameters
-
$sender
: string
-
Return values
array<string|int, mixed>
threadIdForResource()
protected
threadIdForResource(array<string|int, mixed> $raw, array<string|int, mixed> $fallback) : string
Parameters
-
$raw
: array<string|int, mixed>
-
-
$fallback
: array<string|int, mixed>
-
compareMessageDates()
private
compareMessageDates(array<string|int, mixed> $a, array<string|int, mixed> $b) : int
Parameters
-
$a
: array<string|int, mixed>
-
-
$b
: array<string|int, mixed>
-