Glassfy Function


Functions let you create your own connectors within your dashboard and send data to new tools with just a few lines of JavaScript - no additional infrastructure required.

Your function will take events from glassfy system, transform and deliver them to any external tool or API without worrying about setting up or maintaining any infrastructure.

Use cases:

  • Send data from Glassfy to a service that’s still not supported
  • Transform data before sending it downstream
  • Enrich outgoing data using external APIs

See our Youtube Tutorial below for inspiration and guidance:

Create a function

  1. Navigate to Glassfy Dashboard → Connectors
  2. Click Create Connectors
  3. Select Glassfy Function

On the modal window

  1. Optionally add a description and configure settings
  2. Upload your source file as described in the next section
  3. Make sure the state of the connector is Enable and select Save

The settings will be available as property of the context parameter passed as the second argument to your handler.

Code your function

The handler is the function in you code that process events. On every new event generated for your app, Glassfy will call the handler onEvent with two arguments:

  • event - Glassfy Event
  • context - Additional context about the event

The example below shows a function that sends some event details to slack.

Create a Slack webhook URL following this guide and add it in the function setting as SLACK_URL

const fetch = require('node-fetch');

exports.onEvent = async function (event, context) {
  console.log(`Processing Event ${}`);
  const body = {
    text: `👋 Glassfy Function - event ${}`

  const url = context.settings.SLACK_URL;
  await fetch(url, {
    method: 'POST',
    body: JSON.stringify(body),
    headers: { 'Content-Type': 'application/json' }

The logs from your function will be available for download on the deliveries page

Runtime and dependecies

  • The following packages are available in the function environment:

Currently is not possible to add custom dependencies.

  • Your JavaScript code will be executed as a CommonJS module by NodeJS v18.x with a timeout of 10s


Before running your code with real events, you can disable the connector before saving. Then click the option button on the connector row and select Send Test Event. From the deliveries page you can then check the status and optionally download the logs.


  • Context
settingsContains settings saved with the connector{ [key: string]: string }