Mautic node search struggles

Describe the issue/error/question

I am trying to search all the contacts in mautic to see if a record exists before I create a new record. I have the Mautic Node is connected via Oauth2. Contacts, get all, return all. I am using the search option with expression

{
"csa_no": "{{$json["Paddler 1 CSA"]}}"
}

csa_no is a mautic custom field and I have made sure there is a record in Mautic that is has the Paddler 1 CSA / csa_no field populated with the results of the data query. But the search returns no data.

Am I searching Mautic correctly? I have tried to search via email as well for a known email with the same no data result.

Please share the workflow

{
  "nodes": [
    {
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{$json[\"Paddler 2 Name\"]}}",
              "operation": "isEmpty"
            }
          ]
        }
      },
      "name": "IF K1 Entry (k2 is empty)",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        980,
        -40
      ],
      "notes": "Checks for k1 entry"
    },
    {
      "parameters": {
        "authentication": "oAuth2",
        "operation": "getAll",
        "returnAll": true,
        "options": {
          "search": "={\n\"csa_no\": \"{{$json[\"Paddler 1 CSA\"]}}\"\n}"
        }
      },
      "name": "Mautic",
      "type": "n8n-nodes-base.mautic",
      "typeVersion": 1,
      "position": [
        1260,
        -60
      ],
      "credentials": {
        "mauticOAuth2Api": {
          "id": "12",
          "name": "FP Mautic"
        }
      }
    }
  ],
  "connections": {
    "IF K1 Entry (k2 is empty)": {
      "main": [
        [
          {
            "node": "Mautic",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Share the output returned by the last node

No data

Information on your n8n setup

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

the custom field is type?

Try it like this: csa_no:valueyouarelookingfor. Do not use an expression. Also, if you want to do multiple conditions using spaces. For example: csa_no:123 active:true

Thanks @RicardoE105 and thanks for all your work bringing Mautic into n8n. Appreciated.

The mautic custom field is a number.

That worked. I added in the

csa_no:{{$json["Paddler 1 CSA"]}}

and that search was successful.

Great that t worked. Have fun.

But…

There are 10 items being fed into the mautic node but the search only happens for item 1.

How can I search for all 10 items? That would 10 different csa_no’s

For me, it executes for many inputs it has. Can you share the whole workflow?

{
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        -140,
        400
      ]
    },
    {
      "parameters": {
        "operation": "getAll",
        "limit": 1,
        "options": {
          "search": "",
          "rawData": true
        }
      },
      "name": "Mautic",
      "type": "n8n-nodes-base.mautic",
      "typeVersion": 1,
      "position": [
        320,
        400
      ],
      "credentials": {
        "mauticApi": {
          "id": "431",
          "name": "ultima papa"
        }
      }
    },
    {
      "parameters": {
        "functionCode": "return [\n  {\n    json: {\n      id: 1\n    }\n  },\n    {\n    json: {\n      id: 2\n    }\n  }\n]"
      },
      "name": "Function",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        80,
        400
      ]
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "Function",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Function": {
      "main": [
        [
          {
            "node": "Mautic",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

yes, I see that, but it’s returning them as a single item I think and so I was not seeing them. I think I need to split them into items to be able to keep working with the data? Busy struggling with that step. I am learning 1 node and 1 set at a time.

Workflow is incomplete but here is as far as I have gotten.

{
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        120,
        160
      ]
    },
    {
      "parameters": {
        "requestMethod": "POST",
        "url": "https://api.canoesa.com/v1/exec.php?c=Event&fn=getEntriesList",
        "options": {},
        "bodyParametersUi": {
          "parameter": [
            {
              "name": "key",
              "value": "Ihaveremovedtheforsecurity"
            },
            {
              "name": "eventId",
              "value": "326"
            },
            {
              "name": "limit",
              "value": "=50"
            },
            {
              "name": "offset",
              "value": "=0"
            },
            {
              "name": "sortOrder",
              "value": "DESC"
            }
          ]
        }
      },
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        320,
        160
      ]
    },
    {
      "parameters": {
        "keepOnlySet": true,
        "values": {
          "number": [
            {
              "name": "Paddler 1 CSA",
              "value": "={{$json[\"k1\"][\"csaId\"]}}"
            },
            {
              "name": "Paddler 2 CSA",
              "value": "={{$json[\"k2\"][\"csaId\"]}}"
            },
            {
              "name": "Paddler 3 CSA",
              "value": "={{$json[\"k3\"][\"csaId\"]}}"
            }
          ],
          "string": [
            {
              "name": "Paddler 1 Name",
              "value": "={{$json[\"k1\"][\"name\"]}}"
            },
            {
              "name": "Paddler 2 Name",
              "value": "={{$json[\"k2\"][\"name\"]}}"
            },
            {
              "name": "Paddler 3 Name",
              "value": "={{$json[\"k3\"][\"name\"]}}"
            }
          ]
        },
        "options": {
          "dotNotation": false
        }
      },
      "name": "Set",
      "type": "n8n-nodes-base.set",
      "typeVersion": 1,
      "position": [
        800,
        160
      ]
    },
    {
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{$json[\"Paddler 2 Name\"]}}",
              "operation": "isEmpty"
            }
          ]
        }
      },
      "name": "IF K1 Entry (k2 is empty)",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        980,
        -40
      ],
      "notes": "Checks for k1 entry"
    },
    {
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{$json[\"Paddler 3 Name\"]}}",
              "operation": "isEmpty"
            }
          ]
        }
      },
      "name": "IF K2 Entry (K3 is empty)",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        1140,
        240
      ]
    },
    {
      "parameters": {
        "fieldToSplitOut": "entries",
        "options": {
          "disableDotNotation": false,
          "destinationFieldName": ""
        }
      },
      "name": "Item Lists",
      "type": "n8n-nodes-base.itemLists",
      "typeVersion": 1,
      "position": [
        580,
        160
      ]
    },
    {
      "parameters": {
        "authentication": "oAuth2",
        "operation": "getAll",
        "returnAll": true,
        "options": {
          "search": "=csa_no:{{$json[\"Paddler 1 CSA\"]}}"
        }
      },
      "name": "Mautic",
      "type": "n8n-nodes-base.mautic",
      "typeVersion": 1,
      "position": [
        1260,
        -60
      ],
      "credentials": {
        "mauticOAuth2Api": {
          "id": "12",
          "name": "FP Mautic"
        }
      }
    },
    {
      "parameters": {
        "fieldToSplitOut": "={{Object.values($node[\"Mautic\"].json[\"fields\"][\"social\"][\"csa_no\"]).join(', ')}}",
        "options": {
          "disableDotNotation": false,
          "destinationFieldName": ""
        }
      },
      "name": "Item Lists1",
      "type": "n8n-nodes-base.itemLists",
      "typeVersion": 1,
      "position": [
        1540,
        -60
      ]
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "Item Lists",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set": {
      "main": [
        [
          {
            "node": "IF K1 Entry (k2 is empty)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF K1 Entry (k2 is empty)": {
      "main": [
        [
          {
            "node": "Mautic",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "IF K2 Entry (K3 is empty)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Item Lists": {
      "main": [
        [
          {
            "node": "Set",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Mautic": {
      "main": [
        [
          {
            "node": "Item Lists1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}