13

Creating a ticket with requester as submitter through the v2 API

Hi,

 

Previously we sent support tickets to Zendesk via email by forging the "From"-field to the original requestor. This resulted in a submitter AND the requestor being the same. This was nice since the Zendesk email notifications were from the original requestor and the emails showed relevant information in the From field.

Now, since the email delivery was unreliable, we decided to move to the Zendesk REST API.

However,

curl https://subdomain.zendesk.com/api/v2/tickets.json \
-d "{\"ticket\":{\"subject\":\"TEST TICKET\",\"requester\":{\"name\":\"John Doe\",\"email\":\"somebody@gmail.com\"}, \"description\":\"TEST TICKET\nby John\"}}" \
-H "Content-Type: application/json" \
-v -u agentemail/token:apitoken

creates a ticket which has requestor as somebody@gmail.com, but submitter as "agentemail". We have now tons of notification emails from the 'agentemail'.

AND:

curl https://subdomain.zendesk.com/api/v2/tickets.json \
-d "{\"ticket\":{\"subject\":\"TEST TICKET\",\"requester\":{\"name\":\"John Doe\",\"email\":\"somebody@gmail.com\"}, \"description\":\"TEST TICKET\nby John\"}}" \
-H "Content-Type: application/json" \
-H "X-On-Behalf-Of: somebody@gmail.com" \
-v -u agentemail/token:apitoken

fails as 403 Forbidden.

The question is, how to get the same requestor as the submitter of the ticket through the API when creating a new ticket on behalf of user that we don't know if he/she exists yet?

 

Best,

  • Ville

 

14 comments

  • 0

    Somewhat related to this, I'd like to be able to add comments from specific authors to tickets via the API.  I've tried setting 'author_id' here:

    {"ticket":{"comment":{"public":false,"value":"Bar"},"author_id":1234546}}

    and here:

    {"ticket":{"comment":{"public":false,"value":"Bar","author_id":123456}}}

    but it is silently ignored, and instead the comment is added with the API user as the author.

    Any ideas?

    Thanks

    -Rob

  • 0

    Both the submitter_id and author_id are Read Only fields, and so can not be set.

    The X-On-Behalf-Of: Header will not work for Agents assuming end users, as there is no call open directly to end users in the V2 API.

    Our Developers are working on something for the V2 API to allow something like creating requests on behalf of an end user in the V1 API, and it is hoped to be out in the near future.

     

  • 0

    Hi everyone, please see our new Requests API: https://support.zendesk.com/entries/21964887-comment-as-the-customer-with-the-new-requests-api  This API is intended to allow you to create or update tickets as an end-user and replaces the X-On-Behalf-Of behavior from API v1.

  • 0

    I have the same issue with the new comment restriction, i can't add a author_id or submitter_id or requester_id  in v2.

    So how can a Admin can add a comment in the name of one user now ? 

  • 0

    I'm also having problems. I'd like to have a form on my site where a user comes in, types in their email address and their problem, and I'd submit the form to Zendesk. I can't figure out how to create the ticket and have it appear as if they made it. They may or may not be in the zendesk system already.

  • 0

    Hey Joe! Have you seen the documentation here: http://developer.zendesk.com/documentation/rest_api/tickets.html#creating-a-ticket-with-a-new-requester

    I think this answers your question. Just pass in the value from the email field into the requester:email field in your JSON and it will create the ticket and sends a signup email to the new user. If the user email address already exists, it will add this ticket to their account.

  • 0

    That is an incomplete solution. See these two articles I created:

    https://support.zendesk.com/entries/22135701-api-create-end-users-through-requests-endpoint

    https://support.zendesk.com/entries/22547116-requestor-vs-submitter

    When you use the tickets.json end point, the "submitter" is the agent whose credentials were used for authentication. Zendesk shows this agent as person who entered the comment (it does not even show "on behalf of" anymore). 

    I need a way to create tickets that are both** Submitted AND Requested** by a new end-user.

  • 0

    @Joel are you talking about in the agent interface? We've addressed this in the API level, but the agent interface has yet to reflect this. It's a known bug that we are fixing in an upcoming release.

  • 0

    No, I'm talking about the API. I just tried submitting a test request using the method described at:

    https://support.zendesk.com/entries/21964887-comment-as-the-customer-with-the-new-requests-api

    However, if the end-user email used to authenticate isn't already in Zendesk I get a Unauthorized error "Couldn't authenticate you".

  • 0

    this solution is really an incomplete solution.

    i like to set submitter and requester. both are ignored when i am logging in over the api as zendesk owner.

    i like to do this without use the credentials of my users or my token with their email addresses.

     

     

  • 0

    Is there any news when it is possible to submit a comment on behalf of another user?

  • 0

    Does submitter_id not work? You should be able to specify the submitter_id of the ticket creation request. For new users, you'd need to create the user, determine their id, and then create the ticket with the submitter_id of that user assigned.

    For reference, 

    Some base sample code for creating tickets can be found here:
    http://pastebin.com/u/Mushroomheadbangers

    Might be easier to work with.

  • 0

    Error creating tickets. "-v is not registered as internal or external command"

    curl https://chloeai.zendesk.com/api/v2/tickets.json \
    -d "{\"ticket\":{\"subject\":\"TEST TICKET\",\"requester\":{\"name\":\"John\",\"email\":

    \"somebody@gmail.com\"}, \"description\":\"TEST TICKET\nby John\"}}" \
    -H "Content-Type: application/json" \ -H "X-On-Behalf-Of:dev.bitlifeinfotech@gmail.com"\
    -v -u chloeapi1234+zendesk@gmail.com/token:dsq

    What could be the possible solution.

  • 0

    Hi Gurdeep,

    The -v is for showing more information about the request, it means verbose.  You could try removing it.  Also, I'm curious why you are including the heaer "X-On-Behalf-Of" as that is not included in the API documentation.  Finally, I'd suggest you change your API token as this is a public forum, and with the token you shared here any user can gain access to your Zendesk.

Please sign in to leave a comment.