Hello,
I previously tried enrolling a contact from my custom code using the enrol API : https://legacydocs.hubspot.com/docs/methods/workflows/add_contact and it worked smoothly !
I went today to test my custom code again, and the request is returning 404 error. resource not found.
2022-01-24T09:50:50.907Z ERROR Unhandled Promise Rejection {"errorType":"Runtime.UnhandledPromiseRejection","errorMessage":"HttpError: HTTP request failed","reason":{"errorType":"HttpError","errorMessage":"HTTP request failed","response":{"statusCode":404,"body":{"status":"error","message":"resource not found",...
Does this mean there’s a problem with the API itself or any action that should be taken from my end on my code level ?
My code : ( I am just fetching an email from my deal and passing it to the API to enroll in another workflow, it was working fine a week ago)
const hubspot = require(‘@hubspot/api-client’);
exports.main = (event, callback) => {
const hubspotClient = new hubspot.Client({
apiKey: process.env.hapikey
});
var customerEmail = event.inputFields[‘customer_email’]
console.log(customerEmail)
hubspotClient.apiRequest({
method: ‘POST’,
path: `/automation/v2/workflows/166637661/enrollments/contacts/${customerEmail}?hapikey=${process.env.HAPIKEY}`
});
}
Thanks,