Send information from and back to Zendesk

You can pull data from Zendesk, work on it, and send it back to the ticket.

Before you begin

  • To complete the task, you need your Zendesk API Key. For details on how to generate it, see Zendesk documentation.

  • For some tasks, you might need a Zendesk ticket ID

    Where is the ticket ID
    The ticket ID is the number at the end of the URL that shows when you click the ticket.

Pull data from Zendesk into an instance

  1. In your Next Matter workflow create a new integration step.
  2. To update a ticket, use the following:
  • Method: PUT
  • Headers: Content-Type: application/json
  • Headers: Authorization: ZENDESK_API_KEY
  • URL: https://ZENDESK_DOMAIN.zendesk.com/api/v2/tickets/{{instance_name}}
  • Body might look like the following:
{  
"ticket": {  
   "custom_fields": [  
       { "id": %%ENTER_ZENDESK_FIELD_ID%%, "value": %%ENTER_VALUE%% }  
    ]  //You can find the field ID in Zendesk Admin Center > Objects and rules > Fields
  }  
}

Update a Zendesk ticket with a comment

  1. To update a specific ticket with a comment, use the following integration details:
  • Method: PUT
  • Headers: Content-Type: application/json
  • Headers: Authorization: ZENDESK_API_KEY
  • URL: https://ZENDESK_DOMAIN.zendesk.com/api/v2/tickets/TICKET_ID
  • Body might look like the following:
{
	"ticket": {		
		"comment": {
			"html_body": "PUBLIC_COMMENT", //replace this placeholder. 
			"public": true
		}
	}
}
  1. Create a variable for the ticket ID with the value of $.ticket.id.
  2. Save your changes.

πŸ“˜

You can get your Zendesk ticket ID from the Ticket ID button that's on the top of each ticket in Zendesk. Copy the number without #.

Upload a file and attach it to ticket

To upload a file and attach it to a Zendesk ticket, upload the file first and then attach it to the ticket.

  1. To upload the file, create a custom integration step with the following integration details:
  • Method: POST
  • Headers: Content-Type: FILE_TYPE i.e text/plain
  • Headers: Authorization: ZENDESK_API_KEY
  • URL: https://ZENDESK_DOMAIN.zendesk.com/api/v2/uploads/?filename=FILENAME
    Note that the FILENAME is a placeholder that needs to be replaced by the name of the file you want to upload. If you're uploading multiple files, this needs to be the name of the first file, you want to upload.
  • Ensure the Body type is Form data and has the following details:
Key: data-binary
Type:file
Value: FILE_REFERENCE //replace this with the data reference to the first file you uploaded
  • Create the following variables:
    • an upload variable with the value of $.upload
    • a token variable with the value of $.upload.token
    • a Zendesk file URL variable with the value of $.upload. attachment. content_url
  1. Create another custom integration step to attach the file to the ticket. Use the following details:
  • Method: PUT
  • Headers: Content-Type: application/json
  • Headers: Authorization: ZENDESK_API_KEY
  • URL: https://ZENDESK_DOMAIN.zendesk.com/api/v2/tickets/TICKET_ID/
    Note that the FILENAME is a placeholder that needs to be replaced by the name of the file you want to upload
  • Ensure the Body type is Raw and has the following details:
{
    "ticket": {
        "comment": {
            "body": "MESSAGE_CONTENT",
            "uploads": [
                "{1. Upload File - Integration step - token (plain)}  //you don't ned to update this reference
"
            ]
        }
    }
}