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
| { | |
| "id": "AWb1e8ihMzmB0aArKzGg", | |
| "status": "NOTIFIED", | |
| "timestamp": "2018-11-08T22:40:22Z", | |
| "accountId": 9733, | |
| "element": "hubspot", | |
| "elementInstance": "120964", | |
| "error": "", | |
| "providerData": { | |
| "contacts": [ |
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
| { | |
| "Contact" { | |
| "type":"customer", | |
| "name":"{{G0IW.incoming.body.Name}}", | |
| "city":"{{G0IW.incoming.body.Gemeente}}", | |
| "phone":"{{G0IW.incoming.body.Telefoon}}", | |
| "vat":"{{G0IW.incoming.body.BTW}}", | |
| "email":"{{G0IW.incoming.body.Email}}" | |
| } | |
| } |
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
| //V1 | |
| module.exports = function(context, cb) { | |
| const array = context.data.values; | |
| const result = array.reduce(function(a,b){return a*b;}); | |
| cb(null, { result : result }); | |
| }; | |
| //V2 | |
| /* |
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 (context, cb) { | |
| var mysql = require('mysql@2.7.0'); | |
| var con = mysql.createConnection({ | |
| host: "localhost", | |
| user: "yourusername", | |
| password: "yourpassword", | |
| database: "mydb" | |
| }); | |
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
| function parseAddress(a) {if(typeof a!=="string") throw "Address is not a string.";a=a.trim();var r={},c=a.indexOf(',');r.city=a.slice(0,c);var f=a.substring(c+2),s=f.lastIndexOf(' ');r.state=f.slice(0,s);r.zip=f.substring(s+1);return r;} | |
| module.exports = function(context, cb) { | |
| //context.data contain the request body parameters | |
| var result = { | |
| name:"", | |
| business_name:"", | |
| address:"", | |
| signed_at:"", | |
| city:"", |
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
| export default (request) => { | |
| const xhr = require('xhr'); | |
| // Send data to STAMPLAY | |
| // This is a BLOCK to send arbitrary data to your Stamplay Trigger | |
| // Paste here the Callback URL suggested by Stamplay | |
| const STAMPLAY_HOOK = 'REPLACE_WITH_CALLBACK_URL'; | |
| function notifyStamplay (payload) { |
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
| var Stamplay = require('stamplay') | |
| var stamplay = new Stamplay('appId', 'apiKey') | |
| module.exports = function(context, cb) { | |
| /* | |
| watson_context is the plainObject property of the object Conversation | |
| let's grab it from the parameters passed as input to this code block (context.data) | |
| and save it on a variable to make the edit we want | |
| */ |
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
| /* | |
| Conversation status: | |
| - start | |
| - selectItem | |
| - itemQty | |
| - itemConfirmed | |
| - checkout | |
| - confirmOrder | |
| - confirmTime |
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(context, cb) { | |
| var Stamplay = require('stamplay'); | |
| var stamplay = new Stamplay('APP_ID', 'API_KEY'); | |
| //Retrieve subscription by number | |
| stamplay.Object('subscription').get({number:encodeURIComponent(context.data.number)}, function(err, res){ | |
| var subscription = JSON.parse(res); | |
| //If the subscription exists |
NewerOlder