Pesquisas recentes
Sem pesquisas recentes

Luiz Pina
Entrou em 01 de fev. de 2022
·
Última atividade em 01 de fev. de 2022
Seguindo
0
Seguidores
0
Atividade total
2
Votos
0
Assinatura
1
VISÃO GERAL DA ATIVIDADE
MEDALHAS
ARTIGOS
PUBLICAÇÕES
COMENTÁRIOS NA COMUNIDADE
COMENTÁRIOS EM ARTIGOS
VISÃO GERAL DA ATIVIDADE
Atividade mais recente por Luiz Pina
Luiz Pina criou uma publicação,
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 de fev. de 2022 · Luiz Pina
0
Seguidores
4
Votos
2
Comentários