NAV
cURL Javascript
Follow @synchroniseiorepo

Introduction

Synchronise is a tool that helps you integrate Web Services in your app or IoT project in a breeze. Instead of having to integrate multiple SDKs and libraries, you install only Synchronise’s SDKs in your projet and you will be able to execute any Web Service you want.

Our platform is made of two main elements:

Integrating a Component or a Workflow in your app is easy thanks to our client libraries. They are very similar in every languages making your life as a developer a lot easier. Basically, you work on a Component or Workflow once, and you integrate it everywhere in just seconds.

Components

Components are simple functions written in Node.JS. They can do anything you want them to, from sending an email to cropping an image or even calling a Uber cab. There are dozens of Components already available on our marketplace synchronise.io/marketplace and they are all free to use.

Run a component

Make sure you have integrated our SDK and initialized it before running a Component.

curl -X POST \
     -H "x-synchronise-public-key: {{PUBLIC_KEY}}" \
     -H "Content-Type: application/json" \
     -d '{"id":"ID_OF_COMPONENT" /* , WHATEVER INPUTS YOU WANT TO SEND*/}' \
https://api.synchronise.io/component/run
// We prepopulate the PUBLIC KEY if you are connected to your account
Synchronise.init("{{PUBLIC_KEY}}");

Synchronise.Component.run("ID_OF_COMPONENT",
    {/* , WHATEVER INPUTS YOU WANT TO SEND*/}, {
    success: function(data){
        console.log(data);
    },
    error: function(err){
        console.log(err);
    },
    always: function(){
        // Always called, whether success or error       
    }
});

Using a Component is very easy thanks to our client libraries. Bear in mind that Components are simply cloud functions. They can be called as many times as you wish and in any order.

Components take Inputs and give Outputs.

Create a Component

Our Market Place is a great opportunity for saving time and avoiding recreating Components that already exists. Despite its richness, you could sometime require a specific action that is not available.
Common reasons for creating your own Components are:

Introduction

We have made it very simple for anyone to create a Component. There are no tools to setup, no software to install and not even a command line interface to harness. Everything happens on our website and it only takes a few minutes to go from idea to a Component available on our Market Place.

We have created a web interface that lets you write code for your Components anywhere you have an internet connection. Here is how it looks like:

Interface

The interface is made of two main elements. Everything on the left side of the screen is about the execution of the Component. That includes the Inputs, Outputs and the actual code. Everything on the right side of the screen is about setting up testing and exporting the Component.

Left side: The code

The left side of the screen displays everything you need to shape the execution of your Component

Right side: The toolbar

Inputs

// To display the Input <b>user_id</b> in the logs we would do
console.log(Input.user_id);

Inputs contain the data your Component can receive when it is executed. A Component can receive an unlimited amount of Inputs. During the execution of your Component, Inputs are available through the special keyword Input.
You can declare Inputs to be delivered to a Component when it is executed. All declared Inputs must have a type (i.e Text, JSON, Number, Date…).
At execution time, the type of an Input is matched against its expected type. If the type of the data does not match the expected type, the request will return an error.
If you need to send an Input without type matching, simply do not declare it. An undeclared Input will still be available in the Component environment.

Type validation:

Outputs

// To return an Output called <b>results</b> we you would do this:
// "Results" does not need to be an array, it can be of any type
Output.results = {
    artist: "Bob Dylan",
    albums: [{
        id:1,
        name: "Blonde On Blonde"
    }]
};
success();

// You can also provide the Output to success() using a JSON object:
success({
    results: {
        artist: "Bob Dylan",
        albums: [{
            id:1,
            name: "Blonde On Blonde"
        }]
    }
});

// And finally you can use a combination of the two.
// The following code will return both the Outputs <b>another</b> and <b>album</b>
Output.another = "Value";
success({
    results: {
        artist: "Bob Dylan",
        albums: [{
            id:1,
            name: "Blonde On Blonde"
        }]
    }
});

Outputs are data that your Component can send/answer when it is executed. It is very similar to the idea of a return statement of a function.
A Component can send an unlimited amount of Outputs.
You can set the value of an Output anytime and anywhere in your code using the special keyword Output.
All declared Outputs are mandatory and failing to provide one of the Output from the Component will return an error.
All declared Outputs must have a type defined (i.e Text, JSON, Number, Date…).
At execution time, the data type of an Output is matched against its expected type.
If the Output data type does not match the expected type, the request will return an error.
You can send any Output you want without type matching, simply do not declare it.
An undeclard Output will still be available on the client when your Component executes. However, it will not be available to be used in a Workflow

Type validation:

Third Party Modules

// Example of using the package 'request'
request('http://www.urltoserver.com', function (error, response, body) {
});

Although creating a Component is quick, it can be even faster with the use of a third party package.
We have installed some public Third Party npm packages on our infrastructure.
They are directly available as global variables in the context of your component.

Cannot find what you are looking for? We are very open to new ideas. If you need a package of any sort, contact us and we will add it in less time than it takes to peel a potato.

Available modules

Crypto
JavaScript implementations of standard and secure cryptographic algorithms.
Keyword: crypto
Documentation

Lazy
JavaScript implementations of standard and secure cryptographic algorithms.
Keyword: crypto
Documentation

Lazy
Lazy lists for node
Keyword: Lazy
Documentation

Buffer
Native Buffer class of Node.JS
Keyword: Buffer
Documentation

Mailgun
Simple Node.js helper module for Mailgun API
Keyword: mailgun
Documentation

Request
Simplified HTTP request client
Keyword: request
Documentation

Underscore
JavaScript’s functional programming helper library
Keyword: _
Documentation

Clearbit
Client for Clearbit.co business intelligence APIs
Keyword: clearbit
Documentation

Stripe
Stripe API wrapper
Keyword: stripe
Documentation

Twilio
A Twilio helper library
Keyword: twilio
Documentation

Xero
A simple node library for Xero Private Applications
Keyword: xero
Documentation

Request a module

We know it is difficult to predict all your wishes. Don’t be shy and let us know what package you need. We will add it to our catalog in no time.

Publishing on the Market Place

Benefits

Review Process

Project Page

Shared Project vs Private Project

SDKs

Node.JS

Download

npm install synchronise –save

Require

var Synchronise = require(‘synchronise’);

Initialize

Synchronise.init(“{{PUBLIC_KEY}}”);

Javascript

Integrate

<script src=“https://js.synchronise.io/1.0.min.js”></script>

Initialize

<script type=“text/javascript”>
Synchronise.init(“{{PUBLIC_KEY}}”);
</script>