Need help - Sending Contact Info from new signup to my Wix CRM through a Wix Api

Alright so here is the situation. I am setting up a system that will allow me to push all my new user signups to my Wix CRM. To do this i set up a HTTP Function within the backend system of my Wix account.

I believe that this is setup correctly and working as intended. I need the contact to only be created if there is a first name, last name, and email. the phone number can be optional.

I set the bubble call like this

the POST web address should be correct, (i just dont know if i should keep it hidden or not so i marked it out, same with the test info in the key values).

When i try to initialize the call this is the response i get

I logged the stringified version of the json object in the console and it looks as thought the body is actually empty.

Any help would be much appreciated!

Can you provide url to doc?
Are you trying to reach this:
If yes, review your payload because it’s far from what wix expect…

Weird, I haven’t seen that document. i was actually utilizing this documentation on the Wix side. createContact - Velo API Reference -

So i changed up a few things and i think I’m a little closer. I think i had the requested object set up wrong so i changed it a little.

When i try to initialize this, i get the error message that i set up at the bottom of the function code(on the left)

I think the problem is that how i have the JSON body written in bubble is wrong. I’m not sure how to set up the array properly from that side to send it in the request. Any thoughts would be much appreciated.

I believe your JS is building an array, but not parsing an array. It seems to be looking for field ‘email’ directly in the JSON body (line 41), just like the firstName and lastName and not an array of “emails”.
It is then taking that field and putting it as the only element in an array to pass forward.
If you always have only one email, simply change the bubble call to pass it
...lastName>", "email":"<email>"}
If you truly need to support an array on bubble side too, change the JS to read the array in a loop and pass to the new array.

1 Like

So that did help, I’m not sure if that change was actually needed but it did prompt me to fix my {}'s which were wrong. once i updated them it finally initialized! so thank you! for anyone in the future wondering how to set up the JSON Body correctly within bubble, here is how i did it.

I will try to add in the array and see if it still works and i will also be adding in the phone number to see if i can get it to send as well and then i will upload that photo so people know how to set up this system.