Skip to main content

Advanced Custom Actions

This example demonstrates how to use actionMeta in custom actions to pass data to subsequent actions.

In this scenario, a custom action custom.parseInvoice extracts an invoice number from the email body and stores it in actionMeta. This value is then accessible in the attachment.store action using the placeholder {{message.invoiceNumber}}.

👉 Edit this example in the playground.

{
"description": "Demonstrates how to use actionMeta to pass data between actions.",
"settings": {
"markProcessedMethod": "mark-read"
},
"global": {
"thread": {
"match": {
"query": "has:attachment -in:trash -in:drafts -in:spam after:{{date.now|formatDate('yyyy-MM-dd')}} is:unread subject:\"[GmailProcessor-Test] customActionsAdvanced\""
}
}
},
"threads": [
{
"match": {
"query": "from:{{user.email}}"
},
"messages": [
{
"actions": [
{
"name": "custom.parseInvoice"
}
],
"attachments": [
{
"match": {
"name": "^invoice\\.pdf$"
},
"actions": [
{
"name": "attachment.store",
"args": {
"location": "/GmailProcessor-Tests/e2e/customActionsAdvanced/{{message.invoiceNumber}}/{{attachment.name}}",
"conflictStrategy": "keep"
}
}
]
}
]
}
]
}
]
}

Source: customActionsAdvanced.ts | Issues: #540