1.4 KiB
1.4 KiB
retailCRM Message Gateway Bot API JS client
This is js retailCRM bot API client.
Installation
npm install --save mg-api-client
In your file
var RetailcrmBotApiClient = require('mg-api-client');
Usage
Get users
var api = new RetailcrmBotApiClient({
host: 'https://api.example.com',
token: 'your bot token',
apiVersion: 'v1' // optional
}).getClient();
api.getUsers()
.then(function (users) {
console.log(users);
})
.catch(function (e) {
console.log(e);
});
Send message
var api = new RetailcrmBotApiClient({
host: 'https://api.example.com',
token: 'your bot token',
apiVersion: 'v1' // optional
}).getClient();
var message = {
chat_id: 1,
content: 'Text message',
scope: 'public',
type: 'text'
};
api.sendMessage(message)
.then(function (result) {
console.log(result);
})
.catch(function (e) {
console.log(e);
});