Need to get tickets.conversation message content in text/plain | Community
Skip to main content

Need to get tickets.conversation message content in text/plain

  • February 5, 2024
  • 4 replies
  • 0 views

Praveen14

I'm trying to get the last conversation message in text format, but the current response returns text/html. Can I get this as text/plain ?

Expected response:

{

  "ticket": {

    "conversation": {

      "message": {

        "content": "my printer is not working",

        "contentType": "text/plain"

      }

    }

  }

}



The response I get:
{

  "ticket": {

    "conversation": {

      "message": {

        "content": "<div class=\"zd-comment\" dir=\"auto\">my printer is not working</div>",

        "contentType": "text/html"

      }

    }

  }

}


TIA

4 replies

Phenol
  • February 8, 2024

How are you getting these ticket details can you please let me know?


Praveen14
  • Author
  • February 8, 2024

Hi @phenol, i'm using the Zendesk - ZAF Client API and the client.get('tickets')

client.get("ticket").then((data) => {
console.log({data})
}



https://developer.zendesk.com/api-reference/apps/apps-core-api/client_api/
https://developer.zendesk.com/api-reference/apps/apps-support-api/ticket_sidebar/#ticket-object


Hi Praveen,
 
The message content type is based on the channel the message was sent from.  So if you're seeing a text/html content type in the response, that is because the message was sent on a channel where that is the supported content type.  We detail the supported content type for each channel in Supported message content types.

Praveen14
  • Author
  • February 21, 2024

Hey @christopher53

Thanks for providing the clarification. 

Cheers!