Skip to content

Instantly share code, notes, and snippets.

View sbkinney's full-sized avatar

Sean Kinney sbkinney

View GitHub Profile
@sbkinney
sbkinney / sync_incident_counts.py
Created March 1, 2022 15:20
Grab the incident counts from problem tickets in Zendesk and write this data back to the tickets in bulk using a custom ticket field
import json
# Customize these four lines for your Zendesk environment
zd_subdomain = 'subdomain' # the portion before .zendesk.com
zd_user = 'youremail@yourdomain.tld/token' # Your email address
zd_token = 'adbjhsabfjhbwshfubwhjsfbnsqjfcn' # Your API token
zd_incident_field = 123456789 # Replace this with the ID of the custom ticket field you're using to store the incident count
zd_headers = {'content-type': 'application/json'}
@sbkinney
sbkinney / redirect.js
Last active December 25, 2015 15:29 — forked from anonymous/gist:6998140
Code snippet for Help Center that allows for forced redirect to the login page if the current user is anonymous/unauthenticated.
$(document).ready(function() {
if(HelpCenter.user.role === "anonymous") {
window.location.replace("/access/unauthenticated?return_to=" + encodeURIComponent(window.location.pathname) + "&theme=hc");
}
}
<?php
$to = ''; //Whatever email you want
$subject = 'Test Target';
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
$message = "POST: \n";
foreach($_POST as $key=>$value)
{
@sbkinney
sbkinney / zendesk_sso_basic.php
Created November 12, 2012 23:40
Example PHP script for SSO for Zendesk
<?
/*
* Remote authentication stub for PHP
*
* This is meant as a template for your own customization. You can identify the user anyway you like,
* integrate it into your intranet, web app or similar.
*
* You may call this script directly or have Zendesk redirect to it using the
* Remote Authentication URL.
*
@sbkinney
sbkinney / import_sat_via_Zendesk_API.js
Created November 9, 2012 01:47
This is a method for pulling Zendesk data from a view via the API into a Google Docs spreadsheet
/* This function runs when the spreadsheet is opened and populates a menu option
labelled Zendesk that contains two options (7 days and 30 days) which are tied
to the listed functions
*/
function onOpen() {
var sheet = SpreadsheetApp.getActiveSpreadsheet();
var entries = [{
name : "Pull Satisfaction Data (last 7 days, rolling)",
functionName : "getSatisfactionDataLast7"
@sbkinney
sbkinney / report-csv-dl-zendesk.php
Created August 2, 2012 18:40 — forked from skipjac/report-csv-dl-zendesk.php
This downloads the scheduled report from Zendesk and saves it to the local server.
<?php
/*********************************************************************************
** This waits for the Zendesk Schedule report call and then downloads the **
** file your Local server for you to act on with other functions or programs **
*********************************************************************************/
$xmlDoc = new DOMDocument();
//Reads the POST from Zendesk