Autotask with webhook AND relayer


I want to pass a POST request to my autotask webhook. The autotask has a relayer connected to it. The following doesn't work -- what is the correct syntax to get 'event'? The event parameter is defined but seems to be a different object. If I disconnect the relayer and remove the credentials param below, I get the event:

const { Relayer } = require('defender-relay-client');

exports.handler = async function(credentials, event) {
  const relayer = new Relayer(credentials);

Hi @zep thanks for reaching out.

The event is actually the first parameter.
Defender will automatically inject temporary credentials to access your Relayer from your Autotask. Simply pass the event object to the relayer client in place of the credentials.

const { Relayer } = require('defender-relay-client');

exports.handler = async function(event) {
  const relayer = new Relayer(event);

You can see more about autotask and relayer integration in the documentation.
You can also checkout more autotask code example on github.

Hope it helps you!