Templating allows you to validate and/or map incoming and outgoing payloads.

As an example, you might want to filter a topic to only allow an event if a type field is test, and then map the outgoing value to be formatted as an email.

Creating a Template

To create a template, navigate over to the Templates section in your navigation. Select a language and create a new template.

After writing the template in one of the languages, you need to assign it to a topic or subscription. To do so, head over to your topic or subscription you wish to change, click to edit the template assigned to it, and select the template that will be executed when the subscriber or topic is invoked.

Templating Languages

There are various languages you can write your templates in. Here, we will discuss them.

  • JSVM will let you run javascript on the events.
  • MAP:JSON will provide a simple way to map payload keys to target keys.
  • VALID:KEYS will let you validate incoming data matches a set of constants.