retailCRM Message Gateway Bot API JS client
This is js retailCRM bot API client.
Installation
npm install --save mg-api-client
In your file
CommonJS
var MgBotApiClient = require('mg-api-client');
es6
import MgBotApiClient from 'mg-api-client';
Usage
Get users
const api = host: 'https://api.example.com' token: 'your bot token' apiVersion: 'v1' // optionalclient; api ;
Send message
const api = host: 'https://api.example.com' token: 'your bot token' apiVersion: 'v1' // optionalclient; let message = chat_id: 1 content: 'Text message' scope: 'public' type: 'text'; api ;
Websocket Example
const WebSocket = ; const api = host: 'https://api.example.com' token: 'your bot token' apiVersion: 'v1' // optionalclient; const wsData = api;const ws = wsData headers: wsData; ws;