Mautic integration [GOT CREATED]

Perfect! It works like a charm.
Great thanks @jan

Happy to hear! Have a great day!

Hi there, can i find some explanation or guide about the credentials i need to ‘create’ in order to connect Mautic to N8n?

Within the n8n interface, i need to ‘add’ url, username and password. Is this the login password for Mautic? Or do i need to ‘create’ api credentials in Mautic?

Thanks in advance for your help!

That should be your regular username and password.

Hi, I’ve add mautic Credential, but in mautic’s field, only has: Email, First Name, Last Name, Primary Company, Position, Title,
Additional Fields have: Ip Address, Last Active, Owner ID

I want to add some other fields: Mobile, Address1, Address2 and tags.
Mobile is key field to create contact in my mautic site.

After that, I want to create a flow when update or insert new Google Sheets row, it will check in my mautic site, contact exists or not (via mobile field). If exists, it will update my contact with new data of fields (with tags)
If not exists, it will create new contact with fields and tags.
Thanks!

Hey @huuich, welcome to the community.

I just added this to my list. In the meantime you can turn the JSON parameters field on and pass the parameters you want to set (Mobile, Address1, Address2 and tags.) in the body.

To check whether the contact exists or not by the phone number I guess you can use the contact:getall and use the optional field Search. Should be set to something like mobile:thephonumber of course assuming the field you are using is called mobile.

If something does make sense or need further clarification simply get back to me. We are happy to help.

1 Like

Thank you for reply, hope to see good news from you soon.

Because I’m newbie so I investigate current n8n, I’ve installed n8n on a VPS successfully and n8n Version: 0.67.3, I’ve add Google API ok and load data from Google Sheet ok, too. But after add Mautic API, create node Mautic like picture, it shows error: “Mautic Error: Looks like I encountered an error (error #404). If I do it again, please report me to the system administrator”,
Excecute note has the same error, please show me how fix this error. Thanks!

Normally 404 means that something did not get found. So I would expect that the URL in the credentials is maybe not set to the correct value. It should be something like this: https://n8n.mautic.net

Fort the case that this is correctly set already did I google and found this.


It seems like that may be also clearing the cache could help.

1 Like

Thanks for reply, but I’m pretty sure that the credential’s mautic is correct because with this credential I’ve use with zapier ok. I’ve cleaned cache, too.

I am not saying the credentials are incorrect, I am saying that the URL you are using could have the wrong format. It is really just supposed to be like in my example above, without any slash or path.

1 Like

Ah, you’re correct without slash, it’s ok, thank you so much!

Ah great to hear that it works now! Have fun with n8n!

1 Like

I’ve turn the JSON parameters field on and pass the parameters. But is there any ways for Mautic API only check new rows on Google Sheets, not all data from Google Sheets? I’ve think about making a new column in Google Sheet like Updated, after data on Google Sheets push to mautic and update, this column will set to 1 and use IF to filter. But I still not successfully with this idea.

Not sure if I fully understand it. I think you want know how to trigger the workflow every time a Google sheet row is either updated or added. If so, sadly that it’s currently no possible but it’s on our list.

If this does not answer your question. Simply get back to me. We are happy to hep.

One possible workaround would be to save in the static data which row was processed last and then only process the new ones. An example for something simlar can be found here where it does get used to process an RSS-Feed:

So is there any way after specific times, like 3 minute, Workflow auto execute from beginning, not care about Google sheet row is either updated or added? Cron trigger can not do this?

@jan @RicardoE105 I can transfer data to my mautic site like I want. I only have small problem with process with Google Sheet, I’ve extract process with Google Sheet below.
I’ve read thread @jan share above but still don’t know how to apply to Google Sheet, I’ve think about use SET to set a column value to 1 when update value with key is mobile.

Example Sheet here: https://docs.google.com/spreadsheets/d/1xk6QMx30xq9gKbnPOaa3uYQatve3sBPo405dQRmWvkM/edit#gid=319478530

And use this code

{
  "name": "18. Google Sheet marks updated 1 ver 4",
  "nodes": [
{
  "parameters": {},
  "name": "Start",
  "type": "n8n-nodes-base.start",
  "typeVersion": 1,
  "position": [
    140,
    290
  ]
},
{
  "parameters": {
    "sheetId": "1xk6QMx30xq9gKbnPOaa3uYQatve3sBPo405dQRmWvkM",
    "range": "HNExtract!A:G",
    "options": {}
  },
  "name": "GS Read Data",
  "type": "n8n-nodes-base.googleSheets",
  "typeVersion": 1,
  "position": [
    390,
    290
  ],
  "credentials": {
    "googleApi": "n8n API"
  }
},
{
  "parameters": {
    "conditions": {
      "number": [],
      "string": [
        {
          "value1": "={{$node[\"GS Read Data\"].json[\"updated\"]}}",
          "operation": "notEqual",
          "value2": "1"
        }
      ]
    }
  },
  "name": "IF Updated not equal 1",
  "type": "n8n-nodes-base.if",
  "typeVersion": 1,
  "position": [
    650,
    290
  ]
},
{
  "parameters": {
    "values": {
      "boolean": [],
      "string": [
        {
          "name": "updated",
          "value": "1"
        }
      ],
      "number": []
    },
    "options": {}
  },
  "name": "Set Updated 1",
  "type": "n8n-nodes-base.set",
  "typeVersion": 1,
  "position": [
    980,
    270
  ]
},
{
  "parameters": {
    "operation": "update",
    "sheetId": "1xk6QMx30xq9gKbnPOaa3uYQatve3sBPo405dQRmWvkM",
    "range": "HNExtract!A:G",
    "key": "mobile",
    "options": {}
  },
  "name": "GS Updated 1",
  "type": "n8n-nodes-base.googleSheets",
  "typeVersion": 1,
  "position": [
    1140,
    210
  ],
  "credentials": {
    "googleApi": "n8n API"
  }
},
{
  "parameters": {
    "operation": "delete",
    "sheetId": "1xk6QMx30xq9gKbnPOaa3uYQatve3sBPo405dQRmWvkM",
    "toDelete": {
      "rows": []
    }
  },
  "name": "GS Delete",
  "type": "n8n-nodes-base.googleSheets",
  "typeVersion": 1,
  "position": [
    1140,
    420
  ],
  "credentials": {
    "googleApi": "n8n API"
  }
}
  ],
  "connections": {
"Start": {
  "main": [
    [
      {
        "node": "GS Read Data",
        "type": "main",
        "index": 0
      }
    ]
  ]
},
"GS Read Data": {
  "main": [
    [
      {
        "node": "IF Updated not equal 1",
        "type": "main",
        "index": 0
      }
    ]
  ]
},
"IF Updated not equal 1": {
  "main": [
    [
      {
        "node": "Set Updated 1",
        "type": "main",
        "index": 0
      }
    ]
  ]
},
"Set Updated 1": {
  "main": [
    [
      {
        "node": "GS Updated 1",
        "type": "main",
        "index": 0
      },
      {
        "node": "GS Delete",
        "type": "main",
        "index": 0
      }
    ]
  ]
}
  },
  "active": false,
  "settings": {},
  "id": "18"
}

And my problem with duplicated data, Google Sheet update operation only update 1 for first data, second data is not. So I think about improve Delete operation here Improve Google Sheets node operation delete. Can you check this or has another solution for this? Thank you!

Hey @huuich sorry for the late response. not sure if I fully understand what asked but check the example below and it should do the trick. Yes, the Google Sheets delete operation can be improved but in the meantime, you can use the index to delete whatever row you need to. I added an index field to my spreadsheet so that when the data goes to the delete operation can be used to delete the right row.

Example spreadsheet here.

And please next time create another topic since this is a question completely unrelated to Mautic and more about Google Sheets.

As always, if something does not make sense, simply get back to me.

{
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        230,
        300
      ]
    },
    {
      "parameters": {
        "authentication": "oAuth2",
        "sheetId": "1G2anQwlwZqShQ_iyts1d1jzJoAahUss0I5CiaO3YweQ",
        "range": "A:E",
        "options": {
          "valueRenderMode": "FORMATTED_VALUE"
        }
      },
      "name": "GS Read Data",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 1,
      "position": [
        510,
        290
      ],
      "credentials": {
        "googleSheetsOAuth2Api": "asasasasasas"
      }
    },
    {
      "parameters": {
        "conditions": {
          "number": [],
          "string": [
            {
              "value1": "={{$node[\"GS Read Data\"].json[\"updated\"]}}",
              "value2": "1"
            }
          ]
        }
      },
      "name": "IF Updated not equal 1",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        800,
        290
      ]
    },
    {
      "parameters": {
        "authentication": "oAuth2",
        "operation": "update",
        "sheetId": "1G2anQwlwZqShQ_iyts1d1jzJoAahUss0I5CiaO3YweQ",
        "range": "A:D",
        "key": "mobile",
        "options": {}
      },
      "name": "GS Read Data1",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 1,
      "position": [
        1370,
        210
      ],
      "credentials": {
        "googleSheetsOAuth2Api": "asasasasasas"
      }
    },
    {
      "parameters": {
        "authentication": "oAuth2",
        "operation": "delete",
        "sheetId": "1G2anQwlwZqShQ_iyts1d1jzJoAahUss0I5CiaO3YweQ",
        "toDelete": {
          "rows": [
            {
              "sheetId": 0,
              "startIndex": "={{$node[\"NoOp\"].json[\"index\"]}}"
            }
          ]
        }
      },
      "name": "GS Read Data2",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 1,
      "position": [
        1380,
        410
      ],
      "credentials": {
        "googleSheetsOAuth2Api": "asasasasasas"
      }
    },
    {
      "parameters": {},
      "name": "NoOp",
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        1050,
        420
      ]
    },
    {
      "parameters": {},
      "name": "NoOp1",
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        1050,
        210
      ]
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "GS Read Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GS Read Data": {
      "main": [
        [
          {
            "node": "IF Updated not equal 1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF Updated not equal 1": {
      "main": [
        [
          {
            "node": "NoOp1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "NoOp",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "NoOp": {
      "main": [
        [
          {
            "node": "GS Read Data2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "NoOp1": {
      "main": [
        [
          {
            "node": "GS Read Data1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
1 Like

@huuich the additional fields got added by @RicardoE105 and released with n8n@0.70.0.

1 Like

I’ve updated to 0.70.0 and now mautic has many additional fields. Thank you @RicardoE105 and @jan

P/s: Could you take a look at this question? When has new contact from mautic, add to Google Sheets!