1
0
mirror of synced 2024-11-24 20:56:03 +03:00
PHP client for MG Bot API
Go to file
2019-06-28 14:43:11 +03:00
extra Initial version (#1) 2019-06-10 16:24:22 +03:00
src Removed void return assertion (PHP 7.0 support) 2019-06-26 11:21:40 +03:00
tests Several quick fixes 2019-06-24 09:34:59 +03:00
.env.dist Default .env.dist values for tests 2019-06-19 12:06:38 +03:00
.gitignore GraphViz Dot inside Travis CI container for diagram generation 2019-06-19 14:03:58 +03:00
.travis.yml Fixes and packages for proper PHP 7.0 support 2019-06-24 13:07:53 +03:00
composer.json Another versions fix, removed unused packages 2019-06-24 13:50:33 +03:00
composer.lock Another versions fix, removed unused packages 2019-06-24 13:50:33 +03:00
LICENSE Initial version (#1) 2019-06-10 16:24:22 +03:00
Makefile Update Makefile 2019-06-28 14:00:19 +03:00
phpstan.neon Update phpstan.neon 2019-06-28 09:46:17 +03:00
phpunit.xml.dist Initial version (#1) 2019-06-10 16:24:22 +03:00
phpunit.xsd Initial version (#1) 2019-06-10 16:24:22 +03:00
README.md Update README.md 2019-06-28 14:43:11 +03:00

Build Status Latest stable PHP from Packagist

retailCRM API PHP client

This is php retailCRM MG Bot API client.

Requirements

  • PHP 7.0 and above
  • PHP's cURL support
  • PHP's JSON support

Install

  1. Get composer

  2. Run into your project directory:

composer require retailcrm/mg-bot-api-client-php ~1.0

If you have not used composer before, include autoloader into your project.

require 'path/to/vendor/autoload.php';

Usage

Assign dialog

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);

    $response = $client->dialogAssign($request);
} catch (\RetailCrm\Common\Exception\CurlException $exception) {
    echo $exception->getMessage();
} catch (\RetailCrm\Common\Exception\LimitException $exception) {
    echo $exception->getMessage();
} catch (\InvalidArgumentException $exception) {
    echo $exception->getMessage();
} catch (\Exception $exception) {
    echo $exception->getMessage();
}

if ($response->isSuccessful()) {
    $response->getPreviousResponsible();
}

Documentation