This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "emails":{ | |
| "gmailEmails":{ | |
| "filter":{ | |
| "conditions":[{ | |
| "date": "between now and 1 week before now" | |
| }] | |
| }, | |
| "wants": [ | |
| "archive", | |
| "headers", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "nodes":[{ | |
| "#": "First Node", | |
| "input": { | |
| "bucket": "gmailEmails" | |
| }, | |
| "implementation": { | |
| "javascript": "server/node1.js" | |
| }, | |
| "outputs": { | |
| "output1": {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module.exports = function (got) { | |
| // got.in contains the key/value pairs that match the given query | |
| const inData = got.in; | |
| console.log('counter: node1.js: running...', inData.data); | |
| const json = inData.data.map(d => JSON.parse(d.value)); | |
| json.forEach(function(value, i){ | |
| console.log('datum#', i, 'value:', value) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let textUtils = require('@redsift/text-utilities'); | |
| // ... | |
| let counts = others.map(value => { | |
| let text = value.textBody || value.strippedHtmlBody || ''; | |
| let count = textUtils.splitWords(textUtils.trimEmailThreads(text)).length; | |
| return count; | |
| }); | |
| console.log(counts); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "outputs":{ | |
| "exports":{ | |
| "count" : { | |
| "key$schema":"string" | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "nodes":[{ | |
| "#": "First Node", | |
| "input": { | |
| "bucket": "gmailEmails" | |
| }, | |
| "implementation": { | |
| "javascript": "server/node1.js" | |
| }, | |
| "outputs": { | |
| "count": {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let textUtils = require('@redsift/text-utilities'); | |
| module.exports = function (got) { | |
| // got.in contains the key/value pairs that match the given query | |
| const inData = got.in; | |
| console.log('counter: node1.js: running...', inData.data); | |
| const json = inData.data.map(d => JSON.parse(d.value)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| curl -sSL https://static-sdk.redsift.io/install | bash |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| redsift create counter |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const others = json.filter(j => j.user !== j['from'].email); |
OlderNewer