Add a comment to the ticket

2 Comments

  • Eric Nelson
    Zendesk Developer Advocacy
    Hey Andrei,

    You'll want to use the client.request method to make an api call to accomplish this. 
     
    Hope this helps!
    0
  • API System

    You must use an API call. client.invoke or client.set both deal with the agent interface data - assignee, requester, fields values, etc but to update a ticket you must do like this :

    client.get('ticket').then(function(response) {
      let ticket = response['ticket'];
      console.log(ticket['id']);
      client.request({
        url: '/api/v2/tickets/' + ticket['id'],
        contentType: "application/json",
        type: 'PUT',
        data: JSON.stringify({
          "ticket": {
            "comment": {
              "body": "Your comment goes here",
              "public": false
            }
          }
        })
      }).then(function(response) {
        console.log(response)
      })
    });
    0

Please sign in to leave a comment.

Powered by Zendesk