crm-api-template-generator/backend/utils/getHubspotTicket.js

25 lines
495 B
JavaScript
Raw Normal View History

const axios = require('axios')
async function getHubspotTicket(token, contactId,) {
try {
const config = {
method: 'get',
url: `https://api.hubapi.com/crm/v3/objects/contacts/${contactId}/associations/tickets`,
headers: {
'Authorization': `Bearer ${token}`,
"Content-Type": "application/json"
}
}
const { data } = await axios(config)
return data
} catch (error) {
console.error(error)
}
}
module.exports = getHubspotTicket