Search
  • Medium One

Connect Zendesk to Medium One

Updated: May 16

This tutorial will show you how to link your Zendesk account to your Medium One account. 


In this tutorial, you will:

  1. Send Zendesk ticket information to Medium One

  2. Build a Workflow to update Zendesk tickets automatically


Here’s what you need to get started:

  1. Medium One Prototyping Sandbox [Buy]

  2. Zendesk Team Plan or higher


Step 1. Create a Basic User and an API Key

On Medium One, navigate to “Manage Users” under “Setup.” The following menu will appear:

Click on Add User and choose a username and password for the user your Zendesk Information will come from. You will want to remember the username and password for later.

Next, create an API key. Navigate to Manage API keys under Setup on the sidebar. Click add a new API key, and choose a name for it.


Once you hit save, you’ll see your API key.  It will have the same length as above. You will want to remember your API key for later.


Step 2. Create a Target on Zendesk

Log into your Zendesk admin account. Under the setup tab on the sidebar, click on Extensions at the very bottom.

Click Add Target, then click on HTTP Target.

Enter the information shown below, and click save. The link to post to is https://zendesk.mediumone.com/zendesk/log.php.

Step 3. Create a Trigger on Zendesk

Under the Setup tab on the sidebar, click on Triggers under Business Rules.

Copy the following setup:

In JSON Data, copy and paste the following, replacing the keys:

  1. medium_one_basic_user with the basic user username you created in Step 1

  2. medium_one_basic_user_password with the password of the user created in Step 1

  3. medium_one_api_key with the API key you created in Step 1


{"medium_one_basic_user":"YOUR USER",
"medium_one_basic_user_password":"YOUR PASSWORD",
"medium_one_api_key":"YOUR API KEY",
"medium_one_env":"prd",
"ticket_subject": "{{ticket.title}}",
"ticket_description":"{{ticket.description}}",
"ticket_link":"{{ticket.url}}",
"ticket_id" : "{{ticket.id}}",
"ticket_external_id":"{{ticket.external_id}}",
"ticket_source":"{{ticket.via}}",
"ticket_status":"{{ticket.status}}",
"ticket_priority":"{{ticket.priority}}",
"ticket_type":"{{ticket.ticket_type}}",
"ticket_score":"{{ticket.score}}",
"ticket_group_name":"{{ticket.group.name}}",
"ticket_due_date":"{{ticket.due_date}}",
"ticket_latest_comment" :"{{ticket.latest_comment_formatted}}",
"ticket_all_comments":"{{ticket.comments_formatted}}",
"ticket_public_comments":"{{ticket.public_comments_formatted}}",
"account":"{{ticket.account}}",
"assignee_name": "{{ticket.assignee.name}}",
"requester_name":"{{ticket.requester.name}}",
"requester_language":"{{ticket.requester.language}}",
"requester_phone":"{{ticket.requester.phone}}",
"requester_external_id":"{{ticket.requester.external_id}}",
"organization_name":"{{ticket.organization.name}}",
"organization_external_id":"{{ticket.organization.external_id}}",
"ticket_cc":"{{ticket.cc_names}}",
"ticket_tags":"{{ticket.tags}}",
"in_business_hours":"{{ticket.in_business_hours}}",
"ticket_field_id":"{{ticket.ticket_field_ID}}",
"field_option_title_id":"{{ticket.ticket_field_option_title_ID}}",
"incoming_phone_number_id":"{{account.incoming_phone_number_ID}}",
"current_user_name":"{{current_user.name}}",
"current_user_organization_name":"{{current_user.organization.name}}",
"current_user_organization_notes":"{{current_user.organization.notes}}",
"current_user_organization_details":"{{current_user.organization.details}}",
"current_user_external_id":"{{current_user.external_id}}",
"current_user_phone":"{{current_user.phone}}",
"current_user_details":"{{current_user.details}}",
"current_user_notes":"{{current_user.notes}}",
"current_user_language":"{{current_user.language}}",
"current_user_tags":"{{current_user.tags}}",
"requester_email":"{{ticket.requester.email}}",
"current_user_email":"{{current_user.email}}"
} 

Click save. Now an event will be sent to your Medium One account every time a ticket is created.


Step 4. Create a ticket on Zendesk

Go to your Zendesk account and create a ticket. Include as much or as little information as you want; this is just a test ticket to make sure everything has been correctly configured. The add ticket button can be found on the top lefthand side.

Click “Save as New.” Then go back to your Medium One account. Under Config, click on Data Streams.

Select raw data stream and click “Edit.” You should see a list of new tags, all sent from Zendesk. Hit the checkbox next to all of them to use them in workflows. If there are no tags, there was a problem in the configuration. Go back through the previous steps to make sure nothing was missed.


Step 5. Create an API key on Zendesk

Log into your Zendesk Administrative account. Under the Setup tab in the sidebar, click on “API” under Channels.

Make sure Token Access is enabled. Then click on the plus sign to create a new API key.

Enter a description and then copy the key shown below. Save this key for the next step. Click Save to finalize the creation of the key.

Step 6. Enter your Zendesk Credentials on Medium One

Log into your Medium One account. Click on the External APIs tab under Setup (You have to be logged in as a web administrator).

Click “Add a new service key.” Select Zendesk from the list, and enter:

  1. Your Zendesk account’s URL.  i.e https://test.zendesk.com   Note: Be sure to include https:// in the url.

  2. Your Zendesk admin email address.

  3. The API key created in Step 1.

Click Save.

On the next page, you will see a new box for your new Zendesk Credential plus an ID. This is your credential ID.  Make sure to hold onto it because you’ll need it in the next step.


Step 7. Create a Workflow to Respond to Ticket Creation

Go to your Workflow Studio and create a new workflow.

Under the “Tags and Triggers” tab on the righthand side, go under raw and select ‘ticket_id.’

Drag and drop this box onto the Workflow Studio.


Next, click on the tab Modules from the righthand sidebar. 

Under “Foundation,” drag and drop the box Base Python.

Then drag the output node from the green raw.ticket_id box to the blue Python foundation node.

Your workflow should look like this:

Double click on the Base Python box. Copy and paste the following into the box.

Replace “Your Credential ID” with the credential ID you got from the previous step.

import Credentials
import Zendesk
creds = Credentials.use("YOUR CREDENTIAL ID")
log(creds)
auth = Zendesk.authenticate(creds['URL'],creds['username'],creds['API Key'])
ticket_id = IONode.get_input('in1')['event_data']['value']
Zendesk.update_ticket(int(ticket_id), "Processed by Medium One") 

Click Save and Activate.


What this workflow does is write a comment onto any new ticket created on Zendesk saying “Processed by Medium One.” Instead of this line, you can put in any information you want to automatically send back to Zendesk.


To check if this was successful, create a test ticket in Zendesk the same way as in Part 2. Refresh the page, and see the message sent from the workflow on your Zendesk account.


Congrats! You have finished the tutorial.

Want to learn more about what Medium One can do?

Check out our documentation and tutorials & get started on your next IoT project!


Appendix: How to Create a Zendesk ticket from a Workflow

Check out this sample code to create a new ticket on Zendesk:

import Zendesk
import Credentials
creds = Credentials.use("YOUR CREDENTIAL ID")
Zendesk.authenticate(creds['URL'], creds['username'], creds['API Key'])
Zendesk.create_ticket("New Ticket", "This is the content") 


Check out our Zendesk documentation to see all of our Zendesk integrations.

© 2018 Medium One   All Rights Reserved

4633 Old Ironsides Dr. #280, Santa Clara, CA  95054                

info@mediumone.com

|

  • YouTube - White Circle