Connect your API
Call your API with Serverless Functions
In order to send data to your application from the various apps that your users integrate, Xkit connects to your existing API.
Setting up a connection like this is called creating a "Destination" as it is a place that your users' data is sent. Currently, the only type of destination supported is a Serverless Function similar to an AWS Lambda or other cloud function.
Creating a Destination
- Click on the Destinations menu item in the left nav bar
- Click on the Add Destination link
- Select the "Function" type of destination
This brings you to the Destination creation screen where you can write your serverless function.
A Destination is composed of two serverless functions, one to be executed on Upserts, and the other to be executed on Deletes.
Xkit's model is to send you a stream of new and historical data from your users apps. Every time we find a new or changed piece of data, we'll execute the Upsert function. If, on the other hand, a piece of data is deleted in the user's source, we'll execute the Delete function.
Each function is executed with the same few parameters:
variables: the static variables configured in the "variables" section
inputsthe inputs declared in the "Inputs" section, as mapped from each individual source
contextthe Context for which the function is being executed
connectionthe Connection to the source app for which the function is being executed
sourcethe Source app itself (e.g. it's
Variables are static configuration for your function. These are best used for configuration that doesn't change based on the source of the data or the context for which it's being executed. Examples include a base URL for your API.
Inputs are the data that your function expects to receive from each source. The inputs are populated through the mapping which is unique to each source.
Each input declares a specific type and whether it is optional. You are guaranteed that when your function is executed, it will be executed with the inputs of the correct type, and if they are not optional, that they will not be
The only runtime currently supported for functions is Node.js version 14. Some common packages are included by default, which are currently:
axios: ^0.21.1 core-js: ^3.17.2 lodash: ^4.17.21 node-fetch: ^3.0.0 uuid: ^8.3.2
Updated about 1 year ago