Reply Ticket via API

Hello,


I managed to update the status of a ticket through the examples I've found and it works perfect.


The problem is that now I want to answer the ticket via API, so that the response is recorded and in turn the ticket is updated to closed state.


The data sent are:

    $f_url_connection = "$f_url_dominio_freshdesk/helpdesk/tickets/$p_ticket_freshdesk.json";

    $f_data = array(
                "helpdesk_ticket" => array(
                "description" => $p_email_txt,
                "description_html" => $p_email_html,
                "status" => 5
                                          )
                   );

    $f_json_body  = json_encode($f_data, JSON_FORCE_OBJECT | JSON_PRETTY_PRINT);
    $f_header[]   = "Content-type: application/json";
    $f_connection = curl_init ($f_url_connection);

    curl_setopt($f_connection, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($f_connection, CURLOPT_HTTPHEADER, $f_header);
    curl_setopt($f_connection, CURLOPT_HEADER, false);
    curl_setopt($f_connection, CURLOPT_USERPWD, "$f_email_freshdesk:$f_contrasena_freshdesk");
    curl_setopt($f_connection, CURLOPT_POSTFIELDS, $f_json_body);
    curl_setopt($f_connection, CURLOPT_CUSTOMREQUEST, 'PUT');
    curl_setopt($f_connection, CURLOPT_VERBOSE, 1);
    $f_response = curl_exec ($f_connection);
    curl_close ($f_connection);

The problem is that the API does not work, it returns NULL, even connects to update the ticket.


Cozano,


There is no such API to add a reply to a ticket. However we do have API to add a note to a ticket.


Add Note : http://freshdesk.com/api#add_note_to_a_ticket


Hope this sample https://github.com/freshdesk/fresh-samples/blob/master/php_samples/add_note_with_attachemnt.php will help you get started.

Hi,


are there any plans for answering a ticket via api? We want to realise a feature to send an invoice to our customers after generating it in another external system.


Best,

Sven

Hello Sven, 


This is a feature that is on our roadmap and we plan to take it up shortly. I will update this post once it's out.


Rohit

+1 This would be really nice to have

This API is currently in development. Will update this post once it's out.

Hello, IS this feature ready where a ticket can be replied through API. If so I request you guys to make it as easy as updating the description in update API

 where the description is sent as a response . 

+1 for this api. i'm looking forfward to see it release out.

Hello Everyone, We have released the public beta for the v2.0 APIs and this endpoint has been included there - http://developer.freshdesk.com/api/#reply_ticket


Thank you so much for your patience.

api v2 is great.


1. no more { helpdesk_ticket: .. } needed

2. attachments[][resource] turn to attachments[] ... (why design like that in v1? )

3. we can reply now!


I updated my GasFreshdesk to v2, welcome to use it. (only work inside gas now)


# GasFreshdesk - OO Class for Freshdesk API(v2)

GasFreshdesk is a simple Freshdesk API Class for GAS(Google Apps Script). 

Github: https://github.com/zixia/gas-freshdesk


var MyFreshdesk = new Freshdesk('https://domain.freshdesk.com', 'token')

var ticket = new MyFreshdesk.Ticket({
  description:'A description'
  , subject: 'A subject'
  , email: 'you@example.com'
})

ticket.assign(9000658396)
ticket.note({
  body: 'Hi tom, Still Angry'
  , private: true
})
ticket.reply({
  body: 'Hi tom, Still Angry'
  , cc_emails: ['you@example.com']
})
ticket.setPriority(2)
ticket.setStatus(2)

ticket.del()
ticket.restore()

Logger.log('ticket #' + ticket.getId() + ' was set!')

Hi,


As I'm working on a migration tool for moving our existing issues from Jira into Freshdesk, I'm still missing one feature; to be able to add a comment with an author email rather than a userId - in many cases the user may not yet exist and I would not have to go through the hassle of looking up his userId from his email. So: please add userEmail to the reply interface.

@mats how about use ticket.reply?


you can specify cc_emails when you send a reply.

Yes, I realize I can *kind of* model it that way, but in the GUI it would still say the reply was made *by* me, with the CC's added. Not quite what I'd like.

Did you try to create a new contact before you create note? Then your user will exist.


After that, you can create note with the exist user_id.



Hi,

I'm stuck using the reply API while trying to send a message in HTML combined with attachments.

Because of attachments you have to use the form/data version, but then HTML is or rejected, or it prepends a "<div>&quote;</div>" in the body.


Could you post an example of a curl request with HTML AND attachments combined?


Thank you.


PS : alternatively, it would be nice if in the reply API had an option to add the user's html signature stored in Freshdesk instead of having to send it each time.

Login or Signup to post a comment