# Passing a lead from One Mautic to another on Open Mailer

**URL:** <https://forum.mautic.org/t/passing-a-lead-from-one-mautic-to-another-on-open-mailer/20398>\
**Category:** Product Support\
**Created:** [August 7, 2021, 1:30pm UTC](https://forum.mautic.org/t/passing-a-lead-from-one-mautic-to-another-on-open-mailer/20398 "2021-08-07T13:30:04Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![mikew](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mikew/32/5156_2.png) [@mikew](https://forum.mautic.org/u/mikew)\
**Post date:** [August 7, 2021, 1:30pm UTC](https://forum.mautic.org/t/passing-a-lead-from-one-mautic-to-another-on-open-mailer/20398/1 "2021-08-07T13:30:05Z")

</div>

Hi All

I am trying to find a creative way for a non technical person to pass a lead from one Mautic instance to another on the event opened email.

My initial approach was to do this using a webhook and sending the post to a connector as described in @joeyk blog post: [https://joeykeller.com/process-any-webhook-with-mautic-without-zapier/](https://joeykeller.com/process-any-webhook-with-mautic-without-zapier/)

My pain problem over here is that my php is not great and I cannot get the right code to capture the data.

What I did for testing was setup a campaign with an Open Decision and and Action on if opened to send webhookk to an endpoint on [https://hookbin.com/](https://hookbin.com/). Here I can see the payload.

Then I tried to capture that data on the connector side but am unable to figure this out - lack of php knowledge.

This is the code I am trying to use:

```auto
<?php
$loginname = 'myloginname';
// Loginname of your API user
$password = 'my password';
// This is the password of the API user
$siteurl = 'mymautic.com';
// example: mymautic.com

// // receive the webhook
$HTTP_RAW_POST_DATA = file_get_contents('php://input');

// decode the incoming data
$data = json_decode($HTTP_RAW_POST_DATA,true);

// grab values
$email = $data['email'];
$firstname = $data['firstname'];
$tag = 'ACQ-1-Opened';

$curl = curl_init();
// Set some options - we are passing in a user agent too here
  curl_setopt_array($curl, array(
  CURLOPT_RETURNTRANSFER => 1,
  CURLOPT_URL => "https://".$loginname.":".$password."@".$siteurl."/api/contacts/new",
  CURLOPT_USERAGENT => 'Mautic Connector',
  CURLOPT_POST => 1,
// posting the payload
  CURLOPT_POSTFIELDS => array(
    'firstname' => $firstname,
    'email' => $email,
    'tags' => $tag
  )

));
$resp = curl_exec($curl);
curl_close($curl);

file_put_contents("webhooklog.txt",($resp.PHP_EOL),FILE_APPEND);

```

This is what my payload looks like

 ![image](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/d/d2b4893b58fe3a8f805f8adf1ecf692454187d70.png)

If anyone has any other ideas on how to do this would love to hear.`Preformatted text`

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [August 7, 2021, 1:38pm UTC](https://forum.mautic.org/t/passing-a-lead-from-one-mautic-to-another-on-open-mailer/20398/2 "2021-08-07T13:38:15Z")

</div>

What data you eant to pass? Just email?

---

<div class="post-metadata">

**Author:** ![mikew](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mikew/32/5156_2.png) [@mikew](https://forum.mautic.org/u/mikew)\
**Post date:** [August 7, 2021, 4:57pm UTC](https://forum.mautic.org/t/passing-a-lead-from-one-mautic-to-another-on-open-mailer/20398/3 "2021-08-07T16:57:47Z")

</div>

Yes, however I would like to add a tag as well that is static.

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [August 9, 2021, 12:18pm UTC](https://forum.mautic.org/t/passing-a-lead-from-one-mautic-to-another-on-open-mailer/20398/4 "2021-08-09T12:18:42Z")

</div>

For anyone who is interested in this solution, here is a detailed description how to do that in my new blogpost.

> **[The Mighty Pixel, that teleports contacts – Joey Keller](https://joeykeller.com/the-mighty-pixel-that-teleports-contacts/)**

---

<div class="post-metadata">

**Author:** ![mikew](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mikew/32/5156_2.png) [@mikew](https://forum.mautic.org/u/mikew)\
**Post date:** [August 9, 2021, 1:29pm UTC](https://forum.mautic.org/t/passing-a-lead-from-one-mautic-to-another-on-open-mailer/20398/5 "2021-08-09T13:29:18Z")

</div>

Hats off to @joeyk for writing this and especially for taking the time to walk me through it personally!! Thanks Joey!!

---

<div class="post-metadata">

**Author:** ![victorburgos](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/victorburgos/32/1414_2.png) [@victorburgos](https://forum.mautic.org/u/victorburgos)\
**Post date:** [August 13, 2021, 8:38pm UTC](https://forum.mautic.org/t/passing-a-lead-from-one-mautic-to-another-on-open-mailer/20398/6 "2021-08-13T20:38:40Z")

</div>

Different approach but worth checking.  
n8n is like zippier but self hosted.  
There are modules for Mautic integration.  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/1/1e7e93a7e079b04e9221abf274928589aa343cca.png)

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [August 14, 2021, 5:33am UTC](https://forum.mautic.org/t/passing-a-lead-from-one-mautic-to-another-on-open-mailer/20398/7 "2021-08-14T05:33:14Z")

</div>

So what would be the approach? How can N8N manage a tracking pixel?

---

<div class="post-metadata">

**Author:** ![mikew](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mikew/32/5156_2.png) [@mikew](https://forum.mautic.org/u/mikew)\
**Post date:** [August 14, 2021, 9:47am UTC](https://forum.mautic.org/t/passing-a-lead-from-one-mautic-to-another-on-open-mailer/20398/8 "2021-08-14T09:47:18Z")

</div>

I’m very interested in finding out how n8n could catch or somehow match up the tracking.

I have n8n setup and successfully passing leads from an elementor form to mautic. Works perfectly however I am not getting previous or future tracking history of the user.

If we were to pass through the user IP would this fix up the tracking issue ?

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [August 15, 2021, 7:03am UTC](https://forum.mautic.org/t/passing-a-lead-from-one-mautic-to-another-on-open-mailer/20398/9 "2021-08-15T07:03:22Z")

</div>

No.  
You need to fire a tracking pixel before you create a new contact with the API.  
This problem is described here (you and me had a conversation on this):

> [@Tracking Code & Shopify Not Matching up to Contacts](https://forum.mautic.org/t/tracking-code-shopify-not-matching-up-to-contacts/16465/7):
>
> Hey @jordan_ryan , thank you so much for the answer. To make sure I understand it right: Someone visits shopify as an anonymous contact, creating a cookie. This person purchases something, so I fire the tracking pixel containing the email address on the thank you page The contact’s anonymous profile is now extended with the email = converted into a known contact? Joey

There is a brilliant solution for this by Matthias Reich:

[![](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/6/6a574f46bd5cd10be21979e83f0f453d2de59f8c.jpeg "Automatisierte Webinare mit Wordpress + Mautic inkl. Teilnehmer Tracking") ](https://www.youtube.com/watch?v=EQFyPNngpIQ)

It’s in German, but he provides a very elegant code:  
Problem description min 17:00  
For the solution he is using a php redirect (again, brilliant!): min 23:00

Also @robm has a workaround, it is a different approach:

> [@Is anyone willing to share a template to allow me to communicate with the Mautic APi for $100?](https://forum.mautic.org/t/is-anyone-willing-to-share-a-template-to-allow-me-to-communicate-with-the-mautic-api-for-100/19473/36):
>
> Here is my working solution to link Thrive Themes with Mautic. I think this method would work well for most 3rd party form builders, provided they can pass the form variables via URL. I am not using the API connection but it’s an alternative that enables the use of all Mautics actions. [[How to integrate Thrive Leads with Mautic] ](https://www.youtube.com/watch?v=fLxz_xMXQ68)

---

<div class="post-metadata">

**Author:** ![victorburgos](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/victorburgos/32/1414_2.png) [@victorburgos](https://forum.mautic.org/u/victorburgos)\
**Post date:** [August 21, 2021, 12:18am UTC](https://forum.mautic.org/t/passing-a-lead-from-one-mautic-to-another-on-open-mailer/20398/10 "2021-08-21T00:18:25Z")

</div>

> [@mikew](#):
>
> person to pass a lead from one Mautic instance to another on the event opened email

Taking into account that the question is how to pass a lead from one Mautic instance to another on the event opened email, this would be the approach I would take.

1. Create a webhook node on n8n
2. Enable webhook “open email event” on mautic with the webhook url from n8n  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/4/4c9d518b9742886aed500eb36ad61b8649a16a01.png)

With that, you can receive all information about every user who opens an email as you can see on this image:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/c/cc7f3e72d1c38865684c936988553c03714115c4.png)

After that, you can use a mautic node to send the information to another mautic instance or do pretty much anything you want:  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/a/a093e1adf2ba2f8697ada9315c18f9b90de3b7fe.png)
