Lambda Payload Schema

This documentation outlines the format of the payload provided to AWS Lambda in the execution of the Invoke Tagged Lambda Functions and Invoke Named Lambda Function Actions.

Overview

GorillaStack users can pass a payload to their Lambda functions at runtime. Along with this data, GorillaStack provides Rule Execution metadata so that customer code can process information about the Rule's Context, Trigger and preceding Action results.

How to consume the JSON Payload in your Lambda code

GorillaStack provides the user defined payload within a property named lambdaActionPayload and the Rule Execution metadata in a property named ruleExecution.

exports.handler = async (event, context) => {
  const { lambdaActionPayload, ruleExecution } = event;
  // Your code here
  return;
};

lambdaActionPayload

The lambdaActionPayload is formatted as you describe it in the Action definition. It must be a valid JSON Object or Array.

ruleExecution

This is the extra Rule execution metadata provided by GorillaStack. It is described in the block below in JSONSchema.

{
  $id: '/RuleExecution',
  type: 'object',

  properties: {
    teamId: {
      type: 'string'
    },

    ruleId: {
      type: 'string'
    },

    eventId: {
      type: 'string'
    },

    eventResultId: {
      type: 'string'
    },

    rule: {
      $ref: '/Rule'
    },

    ruleState: {
      type: 'string',
      enum: ['active', 'cancelled', 'complete', 'failed', 'pending', 'suspended']
    },

    executionMetadata: {
      $ref: '/RuleExecutionMetadata',
    },
  },
}

{
  $id: '/RuleExecutionMetadata',
  type: 'object',

  properties: {
    triggerData: {
      type: 'object',

      properties: {
        triggerType: {
          type: 'string',
        },
        triggeredBy: {
          type: 'string',
        },
        data: {
          type: 'object',
        }
      },

      additionalProperties: true
    },
    actionData: {
      type: 'array',
      items: {
        type: 'object',

        properties: {
          actionType: {
            type: 'string',
          },
          status: {
            type: 'string',
          },
          data: {
            type: 'object',
          }
        },

        additionalProperties: true
      },
    },
  }
}

Legacy Information

The information in this section is for customers passing payloads to their Lambda functions in versions of this action preceding the 25th October 2019.

Prior to this date, GorillaStack didn’t pass the Rule Execution metadata through to Lambda functions at time of execution, instead passing the payload exactly as it was defined in the Action definition.

When implementing the changes to pass the Rule Execution metadata, the decision was made to avoid making customers update their Lambda functions as a result of the change. As a result, customers that were previously using this Legacy Payload format have an additional option in their Action settings, allowing them to control whether their Actions pass the Legacy Payload or the Latest Payload to their Lambda functions.

All other customers are automatically opted into the Latest Payload.