solbianca / botbuilder
PHP bot for microsoft bot framework rest api
Requires
- guzzlehttp/guzzle: ~6.0
This package is auto-updated.
Last update: 2019-09-02 04:35:50 UTC
README
Installation
composer require solbianca/botbuilder "dev-master"
Usage
Set auth options and authenticate client
$authOptions = [
'grantType' => 'client_credentials',
'clientId' => 'your_client_id',
'clientSecret' => 'your_client_secret',
'scope' => 'https://graph.microsoft.com/.default',
'reciveTokenURL' => 'https://login.microsoftonline.com/common/oauth2/v2.0/token',
];
$client = (new Bot($authOptions))->auth();
Set request post data, make correct response and send it.
$client->setRequest($_POST)->makeResponse('TEST')->send();
Documentation
WARNING! The documentation below may be inaccurate or incomplete.
Client
Client::__construct($authOptions)
`` Client constructor. Initiate instance of Guzzle, authenticate client and receive access token
@param array $authOptions $authOptions = [ 'grantType' => 'client_credentials', 'clientId' => 'your_client_id', 'clientSecret' => 'your_client_secret', 'scope' => 'https://graph.microsoft.com/.default', 'reciveTokenURL' => 'https://login.microsoftonline.com/common/oauth2/v2.0/token', ]; ``
Client::auth()
Authenticate client and receive access token
@return $this
Client::getAccessToken()
Return access token object
@return \SolBianca\BotBuilder\Models\AccessToken
Client::setRequest()
Set request data for client
@param array $request
@return $this
Client::getRequest()
Get request object
@return \SolBianca\BotBuilder\Components\Request
Client::makeResponse()
Create correct response
@param string $message
@return $this
Client::getResponse()
Get response object
@return \SolBianca\BotBuilder\Components\Response
Client::send()
Send answer to service
@return mixed
AccessToken
AccessToken::getTokenType()
@return string
AccessToken::getExpiresIn()
@return int
AccessToken::getAccessToken()
@return string
Request
Request::activity
Get activity object
@var \SolBianca\BotBuilder\Models\Activity;
Request::getRawRequest()
Get raw request data
@return array
Response
Response::activity
Get activity object
@var \SolBianca\BotBuilder\Models\Activity;
Response::message
Get message
@var string
Response::type
Get message type
@var string
Response::asArray()
Get response data as array
@return array
Response::asJson()
Get response data as json string
@return string