'Unable to create HubSpot Contact entry using hubspot-api-client
api = ::Hubspot::Crm::Contacts::BasicApi.new
api.create({firstname: 'john', lastname: 'doe', email: '[email protected]'}.to_json, auth_names: 'hapikey')
The request gets executed, but the details are not visible on Hubspot contactlist, It shows empty contact without firstname, lastname and email.
Here is the response, when I fetch the details by contact_id
<Hubspot::Crm::Contacts::SimplePublicObjectWithAssociations:0x000055d0bc6ad2a8
@archived=false,
@created_at=Fri, 11 Mar 2022 12:52:44 +0000,
@id="456501",
@properties=
{"createdate"=>"2022-03-11T12:52:44.492Z",
"email"=>"",
"firstname"=>"",
"hs_object_id"=>"456501",
"lastmodifieddate"=>"2022-03-11T12:53:01.375Z",
"lastname"=>""},
@updated_at=Fri, 11 Mar 2022 12:53:01 +0000>
I have configured the API key in config file properly
Solution 1:[1]
Try this to update you created contact :
basic_api = ::Hubspot::Crm::Contacts::BasicApi.new
contact_input = ::Hubspot::Crm::Contacts::SimplePublicObjectInput.new(properties: @properties) # your properties
basic_api.update(contact_id, contact_input, { auth_names: 'hapikey'})
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Pak |