InboundProcessor
in package
Table of Contents
Properties
Methods
- __construct() : mixed
- process() : void
- Process incoming Twilio webhook
- calculateSimilarity() : float
- Calculate similarity between two strings (simple word-based similarity) Returns a value between 0 and 1, where 1 is identical
- downloadFile() : string
- Download file from URL and store locally
- extractFiles() : array<string|int, mixed>
- Extract file attachments from Twilio payload
- findOrCreateUser() : User
- Find or create user by phone number
- getExtensionFromMimeType() : string
- Get file extension from MIME type
- handleOnboarding() : void
- Handle onboarding flow - send link to onboarding form
- needsOnboarding() : bool
- Check if user needs onboarding
Properties
$agentService
protected
AgentService
$agentService
$messageService
protected
MessageService
$messageService
$smsService
protected
SmsService
$smsService
Methods
__construct()
public
__construct(MessageService $messageService, AgentService $agentService, SmsService $smsService) : mixed
Parameters
- $messageService : MessageService
- $agentService : AgentService
- $smsService : SmsService
process()
Process incoming Twilio webhook
public
process(array<string|int, mixed> $payload) : void
Parameters
- $payload : array<string|int, mixed>
calculateSimilarity()
Calculate similarity between two strings (simple word-based similarity) Returns a value between 0 and 1, where 1 is identical
protected
calculateSimilarity(string $str1, string $str2) : float
Parameters
- $str1 : string
- $str2 : string
Return values
floatdownloadFile()
Download file from URL and store locally
protected
downloadFile(string $url, string|null $contentType) : string
Parameters
- $url : string
- $contentType : string|null
Return values
stringextractFiles()
Extract file attachments from Twilio payload
protected
extractFiles(array<string|int, mixed> $payload) : array<string|int, mixed>
Parameters
- $payload : array<string|int, mixed>
Return values
array<string|int, mixed>findOrCreateUser()
Find or create user by phone number
protected
findOrCreateUser(string $phone) : User
Parameters
- $phone : string
Return values
UsergetExtensionFromMimeType()
Get file extension from MIME type
protected
getExtensionFromMimeType(string|null $mimeType) : string
Parameters
- $mimeType : string|null
Return values
stringhandleOnboarding()
Handle onboarding flow - send link to onboarding form
protected
handleOnboarding(mixed $user, string $message, bool $isFirstMessage, array<string|int, mixed> $payload) : void
Parameters
- $user : mixed
- $message : string
- $isFirstMessage : bool
- $payload : array<string|int, mixed>
needsOnboarding()
Check if user needs onboarding
protected
needsOnboarding(mixed $user) : bool
Parameters
- $user : mixed