Hello, we use the nodejs SDK API to bulk import contacts into the CRM.
You can see how we use it to import CSV, you can also see the response we get, which is a 400 with no clear error.
Request used: Request
Response:
{
status: 'error',
message: 'Unable to process JSON',
correlationId: 'ad17dc1f-1386-4524-84d0-cd190c3711b9'
}
I had to add console.log in the SDK to understand what request it is producing, and here it is:
{
method: 'POST',
qs: { hapikey: 'eu1-XXX' },
headers: {
'User-Agent': 'hubspot-api-client-nodejs; @VERSION@',
Accept: 'application/json'
},
uri: 'https://api.hubapi.com/crm/v3/imports/',
useQuerystring: true,
json: true,
formData: {
files: '{"name":"anote_platform","files":[{"fileName":"platform.csv","fileFormat":"CSV","dateFormat":"DAY_MONTH_YEAR","fileImportPage":{"hasHeader":true,"columnMappings":[{"columnName":"Email","propertyName":"email","columnObjectType":"CONTACT"},{"columnName":"Platform","propertyName":"hs_content_membership_email_confirmed","columnObjectType":"CONTACT"},{"columnName":"FirstName","propertyName":"firstname","columnObjectType":"CONTACT"}]}}]}',
importRequest: {
value: 'Email,FirstName,LastName,Birthdate,PhoneNumber,City,Country,Gender,Platform,Stars,SUBSCRIBEDATE\n' +
'greg.mathonet@gmail.com,Grégoire,Mathonet,16/05/1995,+352691623187,Luxembourg,LU,M,Y,5,01/07/2021',
options: [Object]
}
}
}
Does it seem like the SDK is producing and valid request to you?
Can you guide me on how to use it properly?
Thanks,