How can I get the whole text interaction in a ticket by using the ZD API?



2022년 10월 26일에 게시됨

Hello, everyone:

What I don't want:
-I don't want/need the comments.
-I'm not looking just for the "description"

What I want is a list or dict of the whole interaction carried by the user because I want to grab and save those words (strings) for a later analysis.

Is that possible?

Thanks in advance for any help ;) 


1

8

댓글 8개

In case there is someone looking for a Python program to get data from Zendesk tickets, you can try this:
https://github.com/diegotco/zendesk_tickets_data

0


Glad to hear it!

Have a great day :)

Tipene

0


Hello, Tipene Hughes

Wow, this is just b e a u t i f u l 

What lovely data, man!

I'm going to have fun iterating through this "actor_type" key on and on 😂:


This is what I was looking for. 

Thanks again Tipene. 

[SOLVED]

0


Hey diegotco,

For chat interactions, you can use the ticket audits endpoint which should return the chat comments individually.

Let me know if that works for you!

 

1


Hello, Tipene:

Before running that script I've reviewed this endpoint https://xxxx.zendesk.com/api/v2/tickets/xxxx/comments

And I get only this:


And that's it, but when I see the ticket it has a lot of text, same thing if I do click over "events":

and...

0


Thanks for clarifying, Diego!
 
There isn't a way to directly grab the comments in the format you're looking for, via the API. I've written up a small example script in the context of a ZAF app that does what you're looking for, though:
 
const getComments = async () => {
// Set ticket Id
const ticketId = 605;

// Get all comments on the ticket
const ticketComments = await client.request(`/api/v2/tickets/${ticketId}/comments`);

// Get the requester ID of the ticket
const ticket = await client.request(`/api/v2/tickets/${ticketId}`);
const requester = ticket.ticket.requester_id;

// Loop over comments and add comment body string to array if comment is made by the requester
const comments = ticketComments.comments.map(
(comment) => comment.author_id !== requester ? "" : comment.body);

console.log(comments);
};

getComments();
 
I hope this helps! Let me know if you have any questions.
 
Tipene

0


Hello, Tipene, thank you for your reply. Yes, text as strings, that's what I want.

0


Hey diegotco,

Just to clarify, are you wanting to pull only the text (as strings) of the replies that a user has made on a ticket?

0


로그인하세요.

원하는 정보를 못 찾으셨나요?

새 게시물