# How to add a contact automatically to Mautic when they register on my App

**URL:** <https://forum.mautic.org/t/how-to-add-a-contact-automatically-to-mautic-when-they-register-on-my-app/31501>\
**Category:** Product Support\
**Created:** [April 1, 2024, 5:01am UTC](https://forum.mautic.org/t/how-to-add-a-contact-automatically-to-mautic-when-they-register-on-my-app/31501 "2024-04-01T05:01:09Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ssdesign](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/ssdesign/32/10291_2.png) [@ssdesign](https://forum.mautic.org/u/ssdesign)\
**Post date:** [April 1, 2024, 5:01am UTC](https://forum.mautic.org/t/how-to-add-a-contact-automatically-to-mautic-when-they-register-on-my-app/31501/1 "2024-04-01T05:01:09Z")

</div>

**Your software**  
My Mautic version is: 4.0.0  
My PHP version is: 7.4.33  
My Database type and version is: Mariadb

**Your problem**  
My problem is:  
Is it possible that whenever someone registers on my mobile App, I want to add that contact email to my Mautic contacts. How do I go about writing the code for that? Is there some documentation I can read about such an integration?

Thanks

These errors are showing in the log:

Steps I have tried to fix the problem:

---

<div class="post-metadata">

**Author:** ![dirk\_s](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/dirk_s/32/748_2.png) [@dirk\_s](https://forum.mautic.org/u/dirk_s)\
**Post date:** [April 1, 2024, 4:42pm UTC](https://forum.mautic.org/t/how-to-add-a-contact-automatically-to-mautic-when-they-register-on-my-app/31501/2 "2024-04-01T16:42:59Z")

</div>

Sure you can do it via the API:

[https://developer.mautic.org/#create-contact](https://developer.mautic.org/#create-contact)

I wrote it a bit more in detail in this thread: [Update the segment and create a contact from the script - #3 by dirk\_s](https://forum.mautic.org/t/update-the-segment-and-create-a-contact-from-the-script/31491/3)

But if you use a mobile App - is there a server side part as well? I ask, because otherwise you would need to include the API key in the mobile App, which may not be the best idea in regards to security.

---

<div class="post-metadata">

**Author:** ![ssdesign](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/ssdesign/32/10291_2.png) [@ssdesign](https://forum.mautic.org/u/ssdesign)\
**Post date:** [April 2, 2024, 3:31am UTC](https://forum.mautic.org/t/how-to-add-a-contact-automatically-to-mautic-when-they-register-on-my-app/31501/3 "2024-04-02T03:31:10Z")

</div>

Thanks a lot @dirk_s  
This is very helpful.  
I read about enabling API from the Configuration panel and when doing so I realized that I do not fully understand how to specify the Redirect URI if its a mobile app?

Any pointers on that?

---

<div class="post-metadata">

**Author:** ![ssdesign](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/ssdesign/32/10291_2.png) [@ssdesign](https://forum.mautic.org/u/ssdesign)\
**Post date:** [April 2, 2024, 3:40am UTC](https://forum.mautic.org/t/how-to-add-a-contact-automatically-to-mautic-when-they-register-on-my-app/31501/4 "2024-04-02T03:40:49Z")

</div>

Also forgot to mention that I am able to include the API key in my app safely.

---

<div class="post-metadata">

**Author:** ![dirk\_s](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/dirk_s/32/748_2.png) [@dirk\_s](https://forum.mautic.org/u/dirk_s)\
**Post date:** [April 3, 2024, 9:14am UTC](https://forum.mautic.org/t/how-to-add-a-contact-automatically-to-mautic-when-they-register-on-my-app/31501/5 "2024-04-03T09:14:07Z")

</div>

The redirection is only needed if you chose the OAuth2 way of authentication. If you want to follow this road, I suggest to read some intro into Oauth2. For basic auth, there is no redirect URI required.

So basically each app instance should contact your mautic directly? No server app in between?

As a side note: Not sure if storing a key in an app can ever be secure?

---

<div class="post-metadata">

**Author:** ![kuzmanyy](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/kuzmanyy/32/390_2.png) [@kuzmanyy](https://forum.mautic.org/u/kuzmanyy)\
**Post date:** [April 3, 2024, 10:38am UTC](https://forum.mautic.org/t/how-to-add-a-contact-automatically-to-mautic-when-they-register-on-my-app/31501/6 "2024-04-03T10:38:48Z")

</div>

Alternatively you can send data via tracking pixel: [Managing Contacts — Mautic Documentation 0.1 documentation](https://docs.mautic.org/en/5.x/contacts/manage_contacts.html#tracking-of-custom-parameters)

Or another approach [GitHub - escopecz/mautic-form-submit: PHP library to forward data to a Mautic form](https://github.com/escopecz/mautic-form-submit)  
Or you can use send data with webhook and process it to Mautic via [Make.com](https://www.make.com/?pc=mtcextendee)

---

<div class="post-metadata">

**Author:** ![ekke](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/ekke/32/296_2.png) [@ekke](https://forum.mautic.org/u/ekke)\
**Post date:** [April 10, 2024, 8:31am UTC](https://forum.mautic.org/t/how-to-add-a-contact-automatically-to-mautic-when-they-register-on-my-app/31501/7 "2024-04-10T08:31:47Z")

</div>

This one is a bit more advanced than the tracking pixel approach, however it too does not require API usage: [GitHub - Leuchtfeuer/mautic-identity-sync: Allow Sync of Identity from outside system e.g. CMS login, though a control pixel with parameters](https://github.com/Leuchtfeuer/mautic-identity-sync)
