class Bot (View source)

Class Bot

Constants

TYPE_GET

Request type GET

TYPE_POST

Request type POST

TYPE_DELETE

Request type DELETE

Properties

protected string $apiUrl FB Messenger API Url
protected null|string $token

Methods

__construct(string $token)

FbBotApp constructor.

setDebug($debug)

No description

$this
setSecret($secret)

No description

array
call(string $url, array $data, string $type = self::TYPE_POST)

Request to API

send(Message $message, string $type = self::TYPE_POST)

Send message to API

sendMessage($message)

No description

sendProfile(array $message, string $type = self::TYPE_POST)

Send messenger profile endpoint

array
sendUserApi($message)

Send user endpoint

debug($request, $response, $status)

No description

Details

__construct(string $token)

FbBotApp constructor.

Parameters

string $token

setDebug($debug)

Parameters

$debug

$this setSecret($secret)

Parameters

$secret

Return Value

$this

protected array call(string $url, array $data, string $type = self::TYPE_POST)

Request to API

Parameters

string $url
array $data
string $type Type of request (GET|POST|DELETE)

Return Value

array

Exceptions

RuntimeException

HandleMessageResponse|array send(Message $message, string $type = self::TYPE_POST)

Send message to API

If instance of ProfileInterface, auto turn to thread_settings endpoint

Parameters

Message $message
string $type

Return Value

HandleMessageResponse|array

Exceptions

RuntimeException

protected HandleMessageResponse sendMessage($message)

Parameters

$message

Return Value

HandleMessageResponse

protected HandleMessageResponse sendProfile(array $message, string $type = self::TYPE_POST)

Send messenger profile endpoint

Parameters

array $message
string $type

Return Value

HandleMessageResponse

Exceptions

RuntimeException

protected array sendUserApi($message)

Send user endpoint

Parameters

$message

Return Value

array

Exceptions

RuntimeException

protected debug($request, $response, $status)

Parameters

$request
$response
$status