Creating new tickets automatically using triggers

Answered

11 Comments

  • Bryan - Community Manager
    Zendesk Developer Support Team

    Kev -- you'll need to reference the requester information of your current ticket and pass it to your target in the trigger's JSON payload. You'll need to use dynamic content to do that. Your JSON payload to your target should look something like:

    {"ticket": { "subject": "About your order ", "public": true, "comment" : {"body": "this is my content."}, "priority": "high", "status": "new", "requester":
    {"name": "{{ticket.requester.name}}", "email": "{{ticket.requester.email}}"} }

    Note: the description of a ticket is set by the first comment -- use the 'comment' attribute for this, not 'description'. Hope this helps!

    2
  • Bryan - Community Manager
    Zendesk Developer Support Team

    PS -- I moved this to the Q&A section of the Community

    0
  • Andrew J
    Community Moderator

    Hello Kev,

    This is an awesome idea - once you've completed it, please write a tutorial to help others along.  I can see this having several use-case for Zendesk users.  Well done so far!

    0
  • Heather Rommel
    Community Moderator

    Kev,

    I bet it's using you as the Requester because it's using your authentication token. Is there any way to test that theory by using another license to set it up?  I don't know how to get around that but at least you'd be closer to the root cause......

    0
  • Dan Cooper
    Community Moderator

    This is impressive.  I'm curious if using the Requests API instead of the Tickets API might help.  The Requests API handles tickets from the end user side, versus the Tickets API which is on the agent side. I can't say that I'm sure it's the solution you need, but since you want the ticket to be set as the requester, it might be a path worth looking into. 

    1
  • Andrew J
    Community Moderator

    Hello Kevin, have you made any further progress on this?

    0
  • Kev Walsh

    Not yet I'm afraid. Other projects have gotten in the way so haven't made any real progress on this. :-(

    0
  • Donald Dushi

    hi all ,

    I tried and it works well

     
    1- Settings>Extensions> a new HTTP destination must be created
    image.png
     
    2 - In Macro add a new TAG
     
    image.png
     
    3- with a trigger, remove the tag and run the API
     
    image.png
     
     
    :)

     

     

     

    0
  • Bradley Stewart

    I'm not seeing the images from Donald's post but I have a it working. Basically using the same ideas as other extensions/webhooks to use the https://myessentials.zendesk.com/api/v2/tickets.json address to create a new ticket.

    I use an API token for credentials so be sure to create an API token first and have it ready for the extension.

    My extension is configured:

    Extension type: HTTP target

    Title: NEW TICKET

    Url: https://YOURDOMAINGOESHERE.zendesk.com/api/v2/tickets.json

    Method: POST

    Content type: JSON

    Basic Authentication: Enabled

    Username YourLoginEMail@domain.com/token (probably needs to be an admin account)

    Password: -token code here-

    Once you have this extension I use a macro that adds tags and a comment to the current ticket and solves it. The tag sets off a trigger that uses the extension. Once the conditions of the trigger are set you just add the notify target and the JSON to create the ticket. (https://developer.zendesk.com/rest_api/docs/support/tickets) Something like:

    Notify Target -> NEW TICKET

    JSON:

    { "ticket": {
    "subject": "Refund check - {{ticket.ticket_field_360003186812}} {{ticket.ticket_field_360003212251}}",
    "comment": { "body": "{{dc.request_check}}" },
    "tags": ["send_check"],
    "requester": { "name": "NameOfRequester", "email": "email@example.com" },
    "custom_fields": [{"id": CustomFieldID1, "value": "{{ticket.ticket_field_CustomFieldID1}}"}, {"id": CustomFieldID2, "value": "{{ticket.ticket_field_CustomFieldID2}}"}, {"id": CustomFieldID3, "value": "{{ticket.ticket_field_CustomFieldID13}}"}, {"id": CustomFieldID4, "value": "{{ticket.ticket_field_CustomFieldID4}}"}, {"id": CustomFieldID5, "value": "{{ticket.ticket_field_CustomFieldID5}}"}]
    }}

    NOTE: The custom fields are mapping the current value on the ticket to the same fields on the new ticket. The {{dc.request_check}} uses a multi line custom field (copied from the original ticket) to populate the first comment with a trigger.

    4
  • Bryan - Community Manager
    Zendesk Developer Support Team

    Thank you very much for sharing this Bradley!

    0
  • Nicole Saunders
    Zendesk Community Team

    This thread has been closed for comments by the Zendesk Community Team. If you have a question you'd like to ask the Zendesk Community, please create a new post

     
    0

Post is closed for comments.

Powered by Zendesk