This documentation outlines the format of the payload provided as the request body when invoking an Azure Function with the Invoke Azure Functions Action.
GorillaStack users can pass a payload to their Azure Function 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.
GorillaStack provides the user defined payload within a property named azureFunctionActionPayload
and the Rule Execution metadata in a property named ruleExecution
.
module.exports = async function (context, req) {
const { azureFunctionActionPayload, ruleExecution } = req.body;
// your code here
context.res = {
status: 200,
body: 'Great Success',
};
};
azureFunctionActionPayload
The azureFunctionActionPayload
is formatted as specified with the JSON Payload property 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
},
},
}
}