Difference between user and agent messages

I’m currently using Tiledesk API and requesting all messages on the client side after app has started.
What is the best way to make difference between user and agent messages to draw them in my UI?

I’m sending GET request on https://api.tiledesk.com/v2/:project_id/requests/:request_id/messages endpoint.

You must call this REST API Requests - Tiledesk Docs to get the request details. From the request detail you can get the requester identifier from the requester object. See the request model here: Requests - Tiledesk Docs

After that you must retrive the messages using Messages - Tiledesk Docs

When you iterate the messages you must compare the sender field of each message with the request.requester.id_user field to understand if a message is sent from the requester, otherwise the message is sent by an agent or a bot.

But anonymous users do not have access to Request API, do they?

You can find the minimum User Role under the Authorization field here:

See here Requests - Tiledesk Docs