Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Zendesk to Statushero
<?php
/*
In Zendesk :
- go to Settings > Extensions > Targets (Paramètres > Extensions > Cibles)
- add a target
- URL target
- Title : Zendesk-Statushero
- URL : https://DOMAIN/PATH/TO/THIS/SCRIPT?assignee={{ticket.assignee.name}}&id={{ticket.id}}&org={{ticket.organization.name}}&title={{ticket.title}}
- Method : GET
- Attribute name : value
- Auth : <none>
- click on Test / submit to test it
- click on Save / submit to add it
After that, we need to add a trigger
- Triggers
- Add a trigger
- Name : Add a reference in statushero
- Description : <what you want>
- Answer to ALL following conditions : "Status" "is" "solved"
- Actions : "Notify the target" "Zendesk-Statushero
- Message : {{ticket.tags}}
*/
$statushero_ID = "YOUR STATUSHERO ID";
$statushero_KEY = "YOUR STATUSHERO KEY";
$assignee = strip_tags($_GET["assignee"]);
$id = strip_tags($_GET["id"]);
$status = strip_tags($_GET["status"]);
$value = strip_tags($_GET["value"]);
$date = strip_tags($_GET["date"]);
$org = strip_tags($_GET["org"]);
$file = 'log.txt';
$error = file_put_contents($file, var_export($_GET, true)."\n", FILE_APPEND);
date_default_timezone_set('Europe/Paris');
//phpinfo();
$command = "curl -i \"https://service.statushero.com/api/v1/status_activities\" -X POST -H \"Content-Type: application/json\" -H \"X-TEAM-ID: ".$statushero_ID."\" -H \"X-API-KEY: ".$statushero_KEY."\" -d '{\"email\":\"".$assignee."\", \"source\":\"Zendesk\", \"source_url\": \"https://YOUR ZENDESK DOMAIN/agent/tickets/".$id."\", \"description\": \"#".$id." ".str_replace("'","&apos;", $org)." : #".implode(" #", explode(" ", $value))." [".date('H:i')."]\"}' ";
exec($command, $result);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.