Using the API to add/update leads

Hey all,

Im trying to create a GravityForms plugin to add/update leads in Mautic, but I’m having trouble understanding the API (note: I’m pretty new to coding with PHP so please go easy on me!).



Would love getting clarification on the following:

  1. I need to be able to map form fields individually by choosing from a list of all the lead fields. I know I create an array with
Code:
$mautic_leads =$leadApi->getFieldList();
, but what does my foreach loop look like for field labels and for field IDs (the latter for when I want to send my updated array back to Mautic).?

2. When using
Code:
$leadApi->edit()
to identify/update an existing lead, what would I use as
Code:
$leadId
to match the listing by email address?. Also, just to verify: adding
Code:
true
as a paramater to
Code:
$leadApi->edit()
will create a new lead only if no lead exists or do I need to perform some duplicate check on the form field first (using
Code:
true
for creating new leads, and leaving it out for updating existing ones)?

3. Whats the function for adding/removing a lead to/from a list?
TIA!

Hey all,
Im trying to create a GravityForms plugin to add/update leads in Mautic, but I’m having trouble understanding the API (note: I’m pretty new to coding with PHP so please go easy on me!).

Would love getting clarification on the following:

  1. I need to be able to map form fields individually by choosing from a list of all the lead fields. I know I create an array with $mautic_leads =$leadApi->getFieldList(); , but what does my foreach loop look like for field labels and for [i]field IDs[i] (the latter for when I want to send my updated array back to Mautic).?

  2. When using $leadApi->edit() to identify/update an existing lead, what would I use as $leadId to match the listing by email address?. Also, just to verify: adding true as a paramater to $leadApi->edit() will create a new lead only if no lead exists or do I need to perform some duplicate check on the form field first (using true for creating new leads, and leaving it out for updating existing ones)?

  3. Whats the function for adding/removing a lead to/from a list?
    TIA!

Gravity also use Form . You will do it through the expansion plugin ?

@Svet Zitrka - the people who make the forms dont have access to mautic, so instead of having them set up an individual mautic form for each GF form, Im creating an Addon that lets users map fields directly in wordpress… or I should say, “Im trying”…

@justlevine There’s now an official Gravity Forms add-on for Mautic, if you’re interested:

https://gravityplus.pro/gravity-forms-mautic/

@naomicbush ‘Now’ is clearly a lie. Signed up, got a ‘well contact you in a week’. Message on the site.
On your main thread, seems this happened to someone else 3 weeks ago to no reply…

@justlevine well, I and all of the wonderful Mautic users I’ve had the opportunity to meet during this time and walk through getting setup with the plugin would disagree with you. My original message was only to offer a possible solution — you could have just said no thank you or nothing at all :slight_smile:

All the best to you.

@naomicbush - not sure why you’re taking offence, when none was meant.
You posted that it was available now on the 21st. In your announcement post in the forum, a week later someone else posts saying they signed up and didn’t receive anything, just a 'It will be available later this week’s notification. He gets no response from you.
Three weeks later, I see the post, send in my email and get the same notification from the website - that it’s not yet available but will be within a week.
Constructive word of advise: perhaps update your site with a bit more clarification? Even ‘We’ll email you a copy within a week’ is more constructive than ‘we’re releasing the plugin within a week’ a month after the initial announcement post…

@justlevine The plugin was available when the announcement was posted here in the forums, so I am respectfully asking you to stop posting misinformation based on conjecture.

Other people are using the plugin, so your posts here are misguided at best and not representative of the helpful community that’s being encouraged here.


To get back to the subject of the thread — if anyone wants to add or update contacts (formerly leads) with Gravity Forms, I know from experience that the Gravity Forms Mautic Add-On works great :slight_smile:

You can map a list of form fields to your contact fields, check for existing contacts before creating new ones, and more.

If you have any questions, contact information is on the plugin page.

@naomicbush . Again no harm meant. As we speak I’m going back to edit my posts.
I seriously was just trying to find out if it was for real after you said it was live, other people posted afterwards that it was unreleased (to no response from you) and the website indicates the same thing.

@naomicbush I subscribed as well and I got the same response as @justlevine. Now I have the feeling I felt for a phishing scam…

If it is really available, and you have the plugin and other users have it, why don’t you help everyone and send us the right link? I gotta agree with the community, It is very frustrating and misleading information.

It would be an amazing service for the Mautic community