Skip to content

Instantly share code, notes, and snippets.

View zubairov's full-sized avatar

Renat Zubairov zubairov

View GitHub Profile
// Please note only Node.js code is supported here
console.log('We have a message query=%j and body=%j', msg.query || {}, msg.body || {});
if (msg.query && msg.body) {
msg.body.__query = msg.query;
}
// Emit the data event
emitter.emit('data', msg);
// No need to emit end
console.log('Finished execution');
curl -X POST https://apixpc.magicsoftware.com/v2/flows \
-u renat+magicsoftware@elastic.io:4fc886b7-fef3-4c1e-a3c1-2f679e278583 \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' -d $'
{
"data": {
"attributes": {
"name": "Copy of Performance Test",
"cron": null,
"default_mapper_type": "jsonata",
@zubairov
zubairov / contact-meta.json
Last active December 28, 2017 09:27
Sample metadata from Salesforce API Version 39
{
"fullName": "Contact",
"actionOverrides": [
{
"actionName": "AddCampaign",
"type": "Default"
},
{
"actionName": "AddToCampaign",
"type": "Default"
package com.acme.comp.actions;
public class CreateCustomerAction extends Component {
@Override
public final void execute(ExecutionParameters parameters) {
logger.info("About to execute create customer action");
// This is an incoming message
final Message message = parameters.getMessage();
// This is outgoing result
var soap = require('soap');
(function () {
'use strict';
describe('Given', function () {
let client = null;
let descriptor = null;
beforeEach(function (done) {
// Here we assume the http://www.webservicex.com/globalweather.asmx?wsdl is accessible
soap.createClient('http://www.webservicex.com/globalweather.asmx?wsdl', function(err, result) {
expect(err).toBeNull();
function* run() {
console.log('Incoming attachments=%j', Object.keys(msg.attachments || {}));
for(let name in msg.attachments) {
let attachment = msg.attachments[name];
console.log('Handling attachment with name=%s url=%s', name, attachment.url);
var result = yield request.get({uri : attachment.url});
console.log('Content of the attachment is %j', result.body);
};
return {};
}
var Q = require('q');
var elasticio = require('elasticio-node');
var messages = elasticio.messages;
var soap = require('soap');
exports.process = processTrigger;
function processTrigger(msg, cfg) {
var self = this;
var username = cfg.username;
// This function will be called by the platform
// to verify credentials
module.exports = function verifyCredentials(credentials, cb) {
// In credentials you will find what users entered in account form
console.log('Credentials passed for verification %j', credentials)
if (true) {
// Verified
return cb(null, {verified: true});
} else {
// Verification failed
## Create
curl -X POST http://requestb.in/api/v1/bins
{
"name" : "WebHook to Mailchimp",
"nodes" : [
{
"action" : "elasticio/webhook:receive",
"config": {
"payload": "email,first,last"
}
},
{