How to use node-red-viseo-helper - 10 common examples

To help you get started, we’ve selected a few node-red-viseo-helper examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github NGRP / node-red-contrib-viseo / node-red-contrib-dialogflow / node-dialogflow.js View on Github external
else {
        // ----> QUERY : DETECT AN INTENT

        let session =  config.session  || "user.id",
            language = config.language || "en",
            text =     config.text     || "payload";

        if (config.languageType !== 'str') {
            let loc = (config.languageType === 'global') ? node.context().global : data;
            language = helper.getByString(loc, language); }
        if (config.sessionType !== 'str') {
            let loc = (config.sessionType === 'global') ? node.context().global : data;
            session = helper.getByString(loc, session); }
        if (config.textType !== 'str') {
            let loc = (config.textType === 'global') ? node.context().global : data;
            text = helper.getByString(loc, text); }

        if (version === "v2") {  // VERSION 2
            try {
                config.tokenv2.authenticate((client, token) => {

                    let key = token.value,
                        sessionPath = "projects/" + config.tokenv2.cred.project_id + "/agent/sessions/" + session;

                    let req = {
                        method: "POST",
                        uri: "https://dialogflow.googleapis.com/v2beta1/" + sessionPath + ":detectIntent",
                        headers: {  
                            'Authorization': 'Bearer ' + key,
                            'Content-Type':  'application/json; charset=utf-8'
                        },
                        body: JSON.stringify({
github NGRP / node-red-contrib-viseo / node-red-contrib-nosql / node-handover.js View on Github external
const remove = (node, data, config) => {

    let dbKey = (config.keyType === "str") ? config.key : helper.getByString(data, config.key, config.key);

    node.server.databaseManager.remove({ id:dbKey}, data, config, function(err, data, result) {
        if (err) node.error(err);
        node.send(data);
    });

}
github NGRP / node-red-contrib-viseo / node-red-contrib-log / node-log-xiti.js View on Github external
const input = (node, data, config) => {
    let now = new Date();
    let pageId = (config.pageIdType === "msg") ? helper.getByString(data, config.pageId) : config.pageId;
    let siteId = (config.siteIdType === "msg") ? helper.getByString(data, config.siteId) : config.siteId;

    let url = 'http://logv2.xiti.com/hit.xiti' + '?s=' + siteId + '&p=' + pageId
            + '&hl='+now.getHours()+'x'+now.getMinutes()+'x'+now.getSeconds();
    
    
    request({ 'url': url },  function (err, response, body) { 
        if (err) node.error(err);
    });

    node.send(data);
}
github NGRP / node-red-contrib-viseo / node-red-contrib-log / node-log-xiti.js View on Github external
const input = (node, data, config) => {
    let now = new Date();
    let pageId = (config.pageIdType === "msg") ? helper.getByString(data, config.pageId) : config.pageId;
    let siteId = (config.siteIdType === "msg") ? helper.getByString(data, config.siteId) : config.siteId;

    let url = 'http://logv2.xiti.com/hit.xiti' + '?s=' + siteId + '&p=' + pageId
            + '&hl='+now.getHours()+'x'+now.getMinutes()+'x'+now.getSeconds();
    
    
    request({ 'url': url },  function (err, response, body) { 
        if (err) node.error(err);
    });

    node.send(data);
}
github NGRP / node-red-contrib-viseo / node-red-contrib-inbenta / node-inbenta-request.js View on Github external
let json = await searchRequest(ibConfig + "/?idata=" + objectId + "&action=click");
            data.payload = JSON.parse(json);
            return node.send(data);
        }
        catch(err) { return node.error(err); }
    }

    else if (action === "rate") {
        let rating = config.objectRating,
            comment = config.objectComment,
            ratingType = config.objectRatingType,
            commentType = config.objectCommentType;

        if (ratingType !== 'str') {
            let loc = (ratingType === 'global') ? node.context().global : data;
            rating = helper.getByString(loc, rating);
        }
        if (commentType !== 'str') {
            let loc = (commentType === 'global') ? node.context().global : data;
            comment = helper.getByString(loc, comment);
        }
        if (comment === undefined || typeof comment !== 'string') comment = '';
        
        try {
            let json = await searchRequest(ibConfig + "/?action=rating-content&idata=" + rating + comment);
            data.payload = JSON.parse(json);
            return node.send(data);
        }
        catch(err) { return node.error(err); }
    }
}
github NGRP / node-red-contrib-viseo / node-red-contrib-ethjs / node-ethjs-transaction.js View on Github external
let cb = (err, result) => {
                if (err) return node.warn(err);
                helper.setByString(data, config.output || 'payload', result)
                node.send(data);
            }
github NGRP / node-red-contrib-viseo / node-red-contrib-ms-search / node-spell-check.js View on Github external
request(req, (err, response, body) => {
        if (err) return node.error(err);
        helper.setByString(data, output, JSON.parse(body));
        return node.send(data);
    });
}
github NGRP / node-red-contrib-viseo / node-red-contrib-aws / node-aws-rekognition.js View on Github external
rekognition[action](params = parameters, function (err, res) {
        if (err) {
            helper.setByString(data, config.output || "payload" , { error: err });
            node.warn("AWS Lex: Error - postText - " + err);
            return node.send(data);
        }
        helper.setByString(data, config.output || "payload" , res);
        return node.send(data);
    });
}
github NGRP / node-red-contrib-viseo / node-red-contrib-google-maps / google-places.js View on Github external
function cb(err, response) {
        if (err) {
            node.warn(err);
            return node.send(data);
        }

        helper.setByString(data, output, response.json);
        return node.send(data);
    }
github NGRP / node-red-contrib-viseo / node-red-contrib-ms-decision / node-content-moderator.js View on Github external
request(req, (err, response, body) => {
        if (err) return node.error(err);
        helper.setByString(data, output, (typeof body === "object") ? body : JSON.parse(body));
        return node.send(data);
    });
}

node-red-viseo-helper

Utility libarary for Node-RED

Apache-2.0
Latest version published 2 months ago

Package Health Score

69 / 100
Full package analysis