Templates

View as Markdown
Last updated November 5, 2026

Overview

Lytics Templates, used with the Lytics Webhook Export workflow, let you build bespoke, real-time integrations with any third-party API. A template defines the payload and profile data that each request carries. You can create templates in the UI or through the Lytics API, in JavaScript, Jsonnet, or Handlebars.js. Once created, a template can be selected in a Webhook Export, which runs it against the outgoing payload of each request.

Template Languages

LanguageAPI type valueDescription
JavaScriptjs1Define a function named template that takes the profile as its data argument and returns the payload. A helper library for hashing, segment events, and job configuration is built in. See Creating JavaScript Templates and Using the JavaScript Library.
JsonnetjsonnetA data-templating language for generating JSON. Import the lytemplates.libsonnet library and read profile fields with event.get(). See Using the Jsonnet Library.
Handlebars.jshandlebarsString templates in Handlebars.js syntax.

In the UI, choose the language from Template Language in the creation wizard. Through the API, pass the API type value when you create the template (see Creating Templates using the API).

Viewing Templates

Templates are in the Lytics UI under Data Pipeline > Templates. The Templates page lists all the templates in an account, along with a button for creating a new one.

Creating Templates

How you create a template depends on whether you use the UI or the API. Start with one of the following guides:

  1. Creating Templates in the UI
  2. Creating Templates using the API
  3. Creating JavaScript Templates
  4. Using the Jsonnet Library
  5. Using the JavaScript Library
  6. Template Examples

For a complete walkthrough with a real destination, see Insider Webhook Templates.

Activating Templates

To activate a template, create a Webhook job: go to Data Pipeline > Jobs, click + Create New, and select the Webhooks provider. See Webhooks for full instructions on configuring outgoing webhooks. From the Lytics Template dropdown menu, select the template to run against each outgoing request. The template's output becomes the request body.

Using Templates

Once you have created your first Template, you can find it in the Template List view, and click on it to access the individual Template. From this view, you can create Webhooks to export users or events using your Template by clicking on the + Create New button. This view will show all of the Webhooks associated with your Template.