Examples

How to call a cloud API and use the result in the task data (Context Augmentation)

var options = {
    method: 'GET',
    url: 'https://weather.com/'+ds.getData(zipcode),
    headers: {
        'X-API-Key':'XUQJbhZGL1DnOWygBg5nati0NDzFuD26Aw_LtrHssX_0k6GbVsWY11R46cCg'
    }
};

request(options, function (error, response, body) {
    var forecast = JSON.parse(body);
    ds.setData('humidity', forecast.humidity);

    session.done();
});

Use crypto package

function generateHMAC(data, secret) {
    const hmac = crypto.createHmac('sha256', secret);
    hmac.update(data);
    return hmac.digest('hex');
}

function generateHash(data) {
    const hash = crypto.createHash('sha256');
    hash.update(data);
    return hash.digest('hex');
}

// HMAC Example
let data = 'myDataToHMAC';
let secret = 'mySecretKey';
let hashedData = generateHash(data);
let hmacResult = generateHMAC(data, secret);

console.log(hashedData);

list of all the available crypto commands

console.log(Object.keys(crypto));