Using POST to Create or Update contact from Facebook

OneSourceLeads
Member

Hi there,

 

I'm attempting to send Facebook leads to a HubSpot account without having the direction integration(admin username and pass).

 

I'm trying to use a custom webhook in Zapier to POST contacts in HubSpot.

 

I have my clients API Key, but I don't have a URL. How do i create or where do I get the URL to send to?

0 Upvotes
2 Replies 2
webdew
Top Contributor | Diamond Partner

Hi @OneSourceLeads ,

You can use this below code for contact create and update via api.

var request = require("request");

var options = { method: 'POST',
url: 'https://api.hubapi.com/contacts/v1/contact/createOrUpdate/email/<EMAIL>/',
qs: { hapikey: 'demo' },
headers:
{ 'Content-Type': 'application/json' },
body:
{ properties:
[ { property: 'firstname', value: <FIRSTNAME> },
{ property: 'lastname', value: <LASTNAME> },
{ property: 'website', value: <WEBSITE> },
{ property: 'company', value: <COMPANY> },
{ property: 'phone', value: <PHONE> },
{ property: 'address', value: <ADDRESS> },
{ property: 'city', value: <CITY> },
{ property: 'state', value: <STATE> },
{ property: 'zip', value: <ZIP> } ] },
json: true };

request(options, function (error, response, body) {
if (error) throw new Error(error);

console.log(body);
});

Documentation Link :
https://legacydocs.hubspot.com/docs/methods/contacts/create_or_update

Hope this helps!


If we were able to answer your query, kindly help the community by marking it as a solution.

Thanks and Regards. 

0 Upvotes
OneSourceLeads
Member

Hi @webdew 

 

I wanted to clarify this part:

 

OneSourceLeads_0-1631723701696.png

 

Who's email or what email do I put in the space you have labeled <EMAIL>? Secondly, where it says "demo" - do I replace that with the exact API key?

0 Upvotes