Búsquedas recientes
No hay búsquedas recientes

Luiz Pina
Incorporación 01 feb 2022
·
Última actividad 01 feb 2022
Seguimientos
0
Seguidores
0
Actividad total
2
Votos
0
Suscripción
1
RESUMEN DE LA ACTIVIDAD
INSIGNIAS
ARTÍCULOS
PUBLICACIONES
COMENTARIOS DE LA COMUNIDAD
COMENTARIOS DE ARTÍCULOS
RESUMEN DE LA ACTIVIDAD
Última actividad de Luiz Pina
Luiz Pina creó una publicación,
I'm working on a new web application in Node JS that needs to access Zendesk to check if there are tickets created for a specific user/requester e-mail (not agent e-mail).
I came accross two scenarios where I could use to make this request. The first one is recommended by Zendesk, which is access Zendesk using one of two API Clients available for Node JS. They are node-zendesk by Farrin Reid and Zendesk NodeJS API written by Adam Gray. Check it out here
The problem is that I am getting the message "Couldn't authenticate you" from Zendesk when I do the fetch. Maybe someone already came accross this problem and could help me out clarifying where exactly is my mistake or what I'm missing in the code.
I would appreciate a light on that.
Here is my code:
async function getZendeskTickets(clientEmail) {
const zendeskAgent = 'agent@email.com'
const api_token = 'some token'
const query = `type:ticket requester:${clientEmail}`;
const url = `https://mydomain.zendesk.com/api/v2/search.json?query=${query}`
try {
const res = await fetch(url, {
method: 'GET',
mode: 'no-cors',
headers: {
'Content-Type': 'application/json',
Authorization: Buffer.from(`${zendeskAgent}/token:${api_token}`).toString('base64'),
}
})
let data = await res.json();
console.log('response', JSON.parse(JSON.stringify(data)))
} catch (error) {
console.log('zendesk response error', error)
}
return
}
Publicado 01 feb 2022 · Luiz Pina
0
Seguidores
4
Votos
2
Comentarios