Библиотеки

Библиотека для связи вашей интеграции с Senler

https://github.com/SenlerBot/senler-integration-bot

npm i senler-integration-bot



import IntegrationConnect from "senler-integration-bot/IntegrationConnect";

const integrationConnect = new IntegrationConnect();
 
 //получение настроек от Senler
   integrationConnect.route('setData', (message) => {
        let settings = message.request.payload;
        if ('private' in settings) {
            console.log(JSON.parse(settings.private));
        }
        if ('public' in settings) {
            console.log(JSON.parse(settings.public))
        }
        message.response.success = true;
        message.send();//отправить ответ
    });

 //запись настроек в Senler
    integrationConnect.route('getData', (message) => {
        message['response'] = {
            payload: {},
            success: true
        };
        
        message.response.payload['public'] =  JSON.parse(localStorage.getItem('tasksP'));
        message.response.payload['private'] = JSON.parse(localStorage.getItem('tasks'));
        message.response.payload['command'] = 'Отправить сообщение';
        message.response.payload['description'] = 'ChatId 1000000';

        message.send();//отправить ответ
    });

Last updated