Two way sync between Notion and Active Campaign

Describe the issue/error/question

I am struggling with the implementation of a two way sync between a table in Notion and ActiveCampaign.

So far I am getting all of the contacts in Active Campaign, and all the items in the list, then merge it. But I don’t know how to proceed.

What is the error message (if any)?

Please share the workflow

{
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        230,
        260
      ]
    },
    {
      "parameters": {
        "operation": "getAll",
        "limit": 3,
        "simple": false,
        "additionalFields": {}
      },
      "name": "ActiveCampaign",
      "type": "n8n-nodes-base.activeCampaign",
      "typeVersion": 1,
      "position": [
        460,
        380
      ],
      "credentials": {
        "activeCampaignApi": {
          "id": "3",
          "name": "ActiveCampaign account"
        }
      }
    },
    {
      "parameters": {
        "resource": "databasePage",
        "operation": "getAll",
        "databaseId": "a91e82ce-0f2b-4049-91be-2437505595e4",
        "returnAll": true,
        "options": {}
      },
      "name": "Notion2",
      "type": "n8n-nodes-base.notion",
      "typeVersion": 1,
      "position": [
        470,
        130
      ],
      "credentials": {
        "notionApi": {
          "id": "1",
          "name": "Notion (Jarvis)"
        }
      }
    },
    {
      "parameters": {},
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "typeVersion": 1,
      "position": [
        700,
        260
      ]
    },
    {
      "parameters": {
        "functionCode": "// Code here will run only once, no matter how many input items there are.\n// More info and help: https://docs.n8n.io/nodes/n8n-nodes-base.function\n\n\n\n\n\n\n// Loop over inputs and add a new field called 'myNewField' to the JSON of each one\nfor (item of items) {\n  item.json.myNewField = 1;\n}\n\n\nvar \n\n\n\n\n\n\n\n\n\n\n\n// You can write logs to the browser console\nconsole.log('Done!');\n\nreturn items;"
      },
      "name": "Function",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        920,
        260
      ]
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "Notion2",
            "type": "main",
            "index": 0
          },
          {
            "node": "ActiveCampaign",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ActiveCampaign": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Notion2": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge": {
      "main": [
        [
          {
            "node": "Function",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Share the output returned by the last node

Information on your n8n setup

  • n8n version:
  • Database you’re using (default: SQLite):
  • Running n8n with the execution process [own(default), main]:
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]:

Welcome to the community @chrisnatterer

I had a look at the workflow, and it seems that you want to do only one sync?

In my mind, two-way sync means that you want to keep a table and a list with the same data. So if one record is added to a table (The one you are monitoring) in notion, the workflow should add it to a list in Active Campaign and vice-versa. If that is the case, you need to use the triggers instead of the regular nodes. It should be similar to the workflow below.

Let me know if that helps and if you have further questions.

Hi Ricardo, thanks for the response.

So I did a one time sync between AC and Notion, using more or less what I shared in the screen.

You’re right, for updates etc. a trigger would be much better, although I still don’t know how to build the following.

(1) Contact gets updated in let’s say ActiveCampaign (for example the tags change)
(2) Look up the matching contact in Notion.
(3) Fully replacing the record in Notion, or better, updating just the fields that have been changed

Contact gets updated in let’s say ActiveCampaign (for example the tags change)

The Active Campaign trigger has an event called contact_tag_added that you can use. If you execute the trigger with this event, then the workflow will start every time a tag is added to an event. There are many events you can use.

(2) Look up the matching contact in Notion.

With the regular Notion node, you can do databasePage:getAll with a filter, where the email is equal to the email returned by the Active Campaign trigger. Then with an IF node, you check whether the output is empty or not, and depending on that you do what is next.

Fully replacing the record in Notion, or better, updating just the fields that have been changed

in Notion, you can do databasePage:update and always update all columns with whatever the Active Campaign trigger returned.

Let me know if that helps or you have further questions.