auths
objectreturn
or this.key = 'value'
, pass input data to your code viaparams
, and maintain state across executions with$checkpoint.async
(event, steps) => {
}
this.THRESHOLD = -0.1;
auths
objectreturn
or this.key = 'value'
, pass input data to your code viaparams
, and maintain state across executions with$checkpoint.async
(event, steps) => {
}
const Sentiment = require('sentiment');
const sentiment = new Sentiment();
this.sentiment = sentiment.analyze(steps.trigger.event.text);
auths
objectreturn
or this.key = 'value'
, pass input data to your code viaparams
, and maintain state across executions with$checkpoint.async
(event, steps) => {
}
if(steps.analyze_text.sentiment.comparative > steps.constants.THRESHOLD) $end('Not unhappy enough.');
let from = '';
if(steps.trigger.event.from && steps.trigger.event.from[0]) {
from = steps.trigger.event.from[0].address;
if(steps.trigger.event.from[0].name) from += ` (${steps.trigger.event.from[0].name})`;
}
let subject = 'No subject';
if(steps.trigger.event.subject) subject = steps.trigger.event.subject;
this.subject = 'Angry Email Report!';
this.body = `
Angry Email Report
Sent from: ${from}
Subject: ${subject}
Message Body:
${steps.trigger.event.text}
`
async
params => {
}
const options = {
subject: params.subject,
text: params.text,
}
if (params.html) {
options.html = params.html
}
if (params.include_collaborators) {
options.include_collaborators = params.include_collaborators
}
$send.email(options)