PHP client for MG Bot API
04cd471765
Bumps [guzzlehttp/psr7](https://github.com/guzzle/psr7) from 1.8.3 to 1.8.5. - [Release notes](https://github.com/guzzle/psr7/releases) - [Changelog](https://github.com/guzzle/psr7/blob/1.8.5/CHANGELOG.md) - [Commits](https://github.com/guzzle/psr7/compare/1.8.3...1.8.5) --- updated-dependencies: - dependency-name: guzzlehttp/psr7 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> |
||
---|---|---|
.github/workflows | ||
extra | ||
src | ||
tests | ||
.env.dist | ||
.gitignore | ||
composer.json | ||
composer.lock | ||
LICENSE | ||
Makefile | ||
phpstan-baseline.neon | ||
phpstan.neon | ||
phpunit.xml.dist | ||
phpunit.xsd | ||
README.md |
Message Gateway Bot API PHP client
Requirements
- PHP 7.1 and above
- PHP's cURL support
- PHP's JSON support
Install
-
Get composer
-
Run into your project directory:
composer require retailcrm/mg-bot-api-client-php ~1.*
If you have not used composer
before, include autoloader into your project.
require 'path/to/vendor/autoload.php';
Usage
Assign dialog
<?php
use RetailCrm\Common\Exception;
use RetailCrm\Mg\Bot\Client;
use RetailCrm\Mg\Bot\Model\Request\DialogAssignRequest;
$client = new Client('https://mg.url.demo', 'T9DMPvuNt7FQJMszHUd', true);
try {
$request = new DialogAssignRequest();
$request->setDialogId(60);
$request->setUserId(4);
/* @var \RetailCrm\Mg\Bot\Model\Response\AssignResponse $response */
$response = $client->dialogAssign($request);
} catch (Exception\LimitException | Exception\InvalidJsonException | Exception\UnauthorizedException $exception) {
echo $exception->getMessage();
}
echo $response->getPreviousResponsible();