1
0
mirror of synced 2024-11-25 05:06:02 +03:00
PHP client for MG Bot API
Go to file
2019-07-16 16:51:01 +03:00
extra Update models & serialization (#3) 2019-07-16 15:04:54 +03:00
src cleanup 2019-07-16 16:41:56 +03:00
tests fixes for tests 2019-07-16 15:20:56 +03:00
.env.dist Update models & serialization (#3) 2019-07-16 15:04:54 +03:00
.gitignore fixes for tests 2019-07-16 15:20:56 +03:00
.travis.yml Update models & serialization (#3) 2019-07-16 15:04:54 +03:00
composer.json Update models & serialization (#3) 2019-07-16 15:04:54 +03:00
composer.lock Update models & serialization (#3) 2019-07-16 15:04:54 +03:00
LICENSE Initial version (#1) 2019-06-10 16:24:22 +03:00
Makefile Update models & serialization (#3) 2019-07-16 15:04:54 +03:00
phpstan.neon Update models & serialization (#3) 2019-07-16 15:04:54 +03:00
phpunit.xml.dist Update models & serialization (#3) 2019-07-16 15:04:54 +03:00
phpunit.xsd Initial version (#1) 2019-06-10 16:24:22 +03:00
README.md cleanup 2019-07-16 16:41:56 +03:00

Build Status Covarage Latest stable PHP from Packagist

Message Gateway Bot API PHP client

This is php library for retailCRM MG Bot API.

Requirements

  • PHP 7.1 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.*

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

Documentation