{
  "name": "Send admin email alerts for paid Sharetribe transactions with Gmail + BillionVerify",
  "nodes": [
    {
      "id": "6d8c8436-38be-4c63-ad02-545a3a33c0b1",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2256,
        176
      ],
      "parameters": {
        "width": 480,
        "height": 864,
        "content": "## [template] Admin Email on New Paid Transaction\n\n### How it works\n\nThis workflow monitors Sharetribe transaction events and filters for transactions that have just moved from pre-payment into a confirmed paid state. When a qualifying transaction is found, it gathers the transaction details and marketplace name, formats the relevant fields, and sends an admin email notification through Gmail.\n\n### Setup steps\n\n- Configure the Sharetribe Trigger with the correct Sharetribe credentials and event subscription for transaction transitions.\n- Configure the Sharetribe action nodes to use the same marketplace credentials and ensure they can read transactions, transitions, and marketplace metadata.\n- Set up the Gmail credential for the admin email sender account.\n- Review the IF node conditions so they match the exact Sharetribe transition names used by the marketplace.\n- Update the Gmail node recipient, subject, and message body for the admin notification.\n\n### Customization\n\nYou can adjust the fields collected in the Set node, change the paid-transition conditions, or modify the email template and recipients to match the marketplace’s operational process."
      },
      "typeVersion": 1
    },
    {
      "id": "f9c778d2-fd99-4ab1-85d0-9dd440092f84",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2816,
        176
      ],
      "parameters": {
        "color": 7,
        "width": 512,
        "height": 320,
        "content": "## Trigger initial filter\n\nStarts when Sharetribe emits a transaction event and checks whether the previous transition was the expected pre-payment state before continuing."
      },
      "typeVersion": 1
    },
    {
      "id": "846b08f8-f709-4a4d-86aa-bcf6116b7916",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3456,
        208
      ],
      "parameters": {
        "color": 7,
        "width": 832,
        "height": 304,
        "content": "## Verify paid transaction\n\nRetrieves the latest transition details, confirms that payment has been completed, and then fetches the full transaction record for the paid transaction."
      },
      "typeVersion": 1
    },
    {
      "id": "cef5d95e-3b6f-4f29-9e4f-49bc44ce5d4c",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        4416,
        208
      ],
      "parameters": {
        "color": 7,
        "width": 832,
        "height": 304,
        "content": "## Prepare and email admin\n\nGets the marketplace name, organizes the transaction and participant fields needed for the message, and sends the admin notification email through Gmail."
      },
      "typeVersion": 1
    },
    {
      "id": "375bfdef-ec59-43b1-bf77-30d277f435ff",
      "name": "When New Sharetribe Event",
      "type": "n8n-nodes-sharetribe.sharetribeTrigger",
      "maxTries": 3,
      "position": [
        2864,
        336
      ],
      "parameters": {
        "simplify": false,
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "eventTypes": [
          "transaction/transitioned"
        ],
        "eventAttributes": [
          "resourceId",
          "previousValues"
        ]
      },
      "credentials": {
        "sharetribeOAuth2Api": {
          "id": "credential-id",
          "name": "Sharetribe Credential"
        }
      },
      "retryOnFail": true,
      "typeVersion": 1,
      "waitBetweenTries": 2000
    },
    {
      "id": "b8aeb9e3-f6c5-4b7b-a60a-706da1d63815",
      "name": "Check Pre-payment Transition",
      "type": "n8n-nodes-base.if",
      "position": [
        3184,
        336
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 1,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "006c0a63-71b0-44a6-8868-65ac81f9f2ba",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.attributes.previousValues.attributes.lastTransition }}",
              "rightValue": "transition/request-payment"
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "d91cf0d7-ae15-41d0-ba49-c0453758ebfe",
      "name": "Fetch Last Transition",
      "type": "n8n-nodes-sharetribe.sharetribe",
      "maxTries": 3,
      "position": [
        3504,
        336
      ],
      "parameters": {
        "resource": "transaction",
        "simplify": false,
        "transactionId": "={{ $json.attributes.resourceId }}",
        "transactionFields": [
          "lastTransition"
        ]
      },
      "credentials": {
        "sharetribeOAuth2Api": {
          "id": "credential-id",
          "name": "Sharetribe Credential"
        }
      },
      "retryOnFail": true,
      "typeVersion": 1,
      "waitBetweenTries": 2000
    },
    {
      "id": "a4ec5f51-e83e-44e1-8b4e-7592a3f15690",
      "name": "Check Payment Confirmation",
      "type": "n8n-nodes-base.if",
      "position": [
        3824,
        336
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 1,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "006c0a63-71b0-44a6-8868-65ac81f9f2ba",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.lastTransition }}",
              "rightValue": "transition/confirm-payment"
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "9bb5f1ce-9f74-4730-b24c-894a79112bce",
      "name": "Fetch Marketplace Name",
      "type": "n8n-nodes-sharetribe.sharetribe",
      "maxTries": 3,
      "position": [
        4464,
        336
      ],
      "parameters": {
        "resource": "marketplace"
      },
      "credentials": {
        "sharetribeOAuth2Api": {
          "id": "credential-id",
          "name": "Sharetribe Credential"
        }
      },
      "executeOnce": true,
      "retryOnFail": true,
      "typeVersion": 1,
      "waitBetweenTries": 2000
    },
    {
      "id": "bddc5d5b-27ef-4502-999c-8dea9dd06714",
      "name": "Prepare Email Fields",
      "type": "n8n-nodes-base.set",
      "position": [
        4784,
        336
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "524fbf5c-9670-408c-a887-cce821ca1f65",
              "name": "transaction.id",
              "type": "string",
              "value": "={{ $('Retrieve Transaction Details').item.json.id }}"
            },
            {
              "id": "f9cc083d-d6d1-494c-96b6-a6747c73f12e",
              "name": "customer.id",
              "type": "string",
              "value": "={{ $('Retrieve Transaction Details').item.json.customer.id }}"
            },
            {
              "id": "9994275b-91b0-42a9-9c02-4c5db3fba497",
              "name": "provider.id",
              "type": "string",
              "value": "={{ $('Retrieve Transaction Details').item.json.provider.id }}"
            },
            {
              "id": "a5af0ae3-ecc3-452d-b1f9-6a50a50a1641",
              "name": "provider.profile.firstName",
              "type": "string",
              "value": "={{ $('Retrieve Transaction Details').item.json.provider.profile.firstName }}"
            },
            {
              "id": "e29e078e-ffbb-4f26-b4cc-075941aefb7a",
              "name": "customer.profile.firstName",
              "type": "string",
              "value": "={{ $('Retrieve Transaction Details').item.json.customer.profile.firstName }}"
            },
            {
              "id": "7290b7b7-1e53-4c5f-88f6-cda0fd02779d",
              "name": "listing.title",
              "type": "string",
              "value": "={{ $('Retrieve Transaction Details').item.json.listing.title }}"
            },
            {
              "id": "1c007860-e852-4e99-a706-d77d5d1675db",
              "name": "operatorRevenue",
              "type": "object",
              "value": "={{ {\"amount\": $('Retrieve Transaction Details').item.json.payinTotal.amount -  $('Retrieve Transaction Details').item.json.payoutTotal.amount, \n\"currency\": $('Retrieve Transaction Details').item.json.payoutTotal.currency} }}"
            },
            {
              "id": "287b88f9-5c52-4247-bfec-e34b03ae4715",
              "name": "marketplaceName",
              "type": "string",
              "value": "={{ $json.name }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "7a30bf0d-8b95-4bd9-8939-b250ba6a87af",
      "name": "Send Admin Payment Email",
      "type": "n8n-nodes-base.gmail",
      "position": [
        5104,
        336
      ],
      "webhookId": "797d9401-ac4d-400e-9bc1-9f351fcd8c46",
      "parameters": {
        "sendTo": "user@example.com",
        "message": "=New Paid Transaction\n\nHey There,\n\nA transaction payment has been confirmed on {{ $json.marketplaceName }} for \"{{ $json.listing.title }}\".\n\nMarketplace revenue: {{ new Intl.NumberFormat('en-US', { style: 'currency', currency: $json.operatorRevenue.currency }).format($json.operatorRevenue.amount / 100) }}\n\nView transaction details: https://console.sharetribe.com/transactions/{{ $json.transaction.id }}",
        "options": {},
        "subject": "=New paid transaction for {{ $json.marketplaceName }}",
        "emailType": "text"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "credential-id",
          "name": "Gmail Credential"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "ce83dd17-5e5b-4436-a2af-ba172979a5a3",
      "name": "Retrieve Transaction Details",
      "type": "n8n-nodes-sharetribe.sharetribe",
      "maxTries": 3,
      "position": [
        4144,
        336
      ],
      "parameters": {
        "resource": "transaction",
        "simplify": false,
        "userFields": [
          "firstName",
          "email",
          "lastName"
        ],
        "listingFields": [
          "title"
        ],
        "transactionId": "={{ $json.id }}",
        "transactionFields": [
          "booking",
          "createdAt",
          "customer",
          "lastTransition",
          "lastTransitionedAt",
          "payinTotal",
          "payoutTotal",
          "state",
          "provider",
          "listing"
        ]
      },
      "credentials": {
        "sharetribeOAuth2Api": {
          "id": "credential-id",
          "name": "Sharetribe Credential"
        }
      },
      "retryOnFail": true,
      "typeVersion": 1,
      "waitBetweenTries": 2000
    },
    {
      "parameters": {
        "operation": "verify",
        "email": "={{ $json.email || $json.Email }}",
        "additionalOptions": {}
      },
      "type": "n8n-nodes-billionverify.billionVerify",
      "typeVersion": 1,
      "position": [
        4744,
        336
      ],
      "name": "Verify Email (BillionVerify)",
      "credentials": {
        "billionVerifyApi": {
          "id": "",
          "name": "BillionVerify account"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "is-deliverable",
              "leftValue": "={{ $json.is_deliverable }}",
              "rightValue": "",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              }
            }
          ]
        }
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        4924,
        336
      ],
      "name": "IF deliverable"
    }
  ],
  "connections": {
    "Prepare Email Fields": {
      "main": [
        [
          {
            "node": "Verify Email (BillionVerify)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Last Transition": {
      "main": [
        [
          {
            "node": "Check Payment Confirmation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Marketplace Name": {
      "main": [
        [
          {
            "node": "Prepare Email Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When New Sharetribe Event": {
      "main": [
        [
          {
            "node": "Check Pre-payment Transition",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Payment Confirmation": {
      "main": [
        [
          {
            "node": "Retrieve Transaction Details",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Pre-payment Transition": {
      "main": [
        [
          {
            "node": "Fetch Last Transition",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Retrieve Transaction Details": {
      "main": [
        [
          {
            "node": "Fetch Marketplace Name",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Verify Email (BillionVerify)": {
      "main": [
        [
          {
            "node": "IF deliverable",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF deliverable": {
      "main": [
        [
          {
            "node": "Send Admin Payment Email",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    }
  },
  "settings": {}
}