Skip to content

Instantly share code, notes, and snippets.

Thomas Stachl tstachl

Block or report user

Report or block tstachl

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@tstachl
tstachl / FetchingLabels.class
Created Feb 12, 2014
Shows how you can use the Force.com Desk.com API client to fetch labels from a specific case.
View FetchingLabels.class
try {
DeskClient client = new DeskClient(new Map<String, String>{
'username' => 'you@example.com',
'password' => 'your_password',
'subdomain' => 'your_subdomain'
});
List<Object> labels = (List<Object>)client.getResource('cases').find(3368).get('labels');
// get the count of the labels
System.debug(labels.size());
@tstachl
tstachl / customer_theme.html
Created Feb 20, 2014
This shows how you can use javascript to fetch the assigned group from the case tab and based on the value show an additional custom field on the customer theme.
View customer_theme.html
<div class="agent_customer_section" id="my_custom_field" style="display:none;">
{{custom_my_custom_field}}
</div>
<script>
$(function() {
var case_assigned_group = $('#edit_customer_{{customer.id}}')
.closest('#case_sidebar')
.find('#ticket_group_id option:selected')
.text();
View reply.json
{
"direction": "in",
"status": "received",
"to": "Helpdesk <helpdesk@myhelpdesk.com>",
"from": "Jane Doe <jane@example.com>",
"subject": "Replying to a case via the API",
"body": "Please assist me with this case",
"created_at": "2012-05-02T21:38:48Z"
}
View create_case.json
{
"type": "email",
"subject": "Creating a case via the API",
"priority": 4,
"status": "open",
"labels": [
"Spam",
"Ignore"
],
"language": "fr",
View email_widget.html
<!--If you already have jquery on the page you don't need to insert this script tag-->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" type="text/javascript"></script>
<link href="https://d218iqt4mo6adh.cloudfront.net/assets/widget_embed_191.css" media="screen" rel="stylesheet" type="text/css" />
<!--If you already have fancybox on the page this script tag should be omitted-->
<script src="https://d218iqt4mo6adh.cloudfront.net/assets/widget_embed_libraries_191.js" type="text/javascript"></script>
<script>
// ********************************************************************************
// This needs to be placed in the document body where you want the widget to render
View create_customer.js
client.post('/api/v2/customers', {
"emails": [
{
"type": "home",
"value": "jsmith@example.com"
}
],
"custom_fields": {
"user_id": null
}
@tstachl
tstachl / create_qna_case.rb
Created Mar 7, 2014
Creating a QNA case using the ruby wrapper ...
View create_qna_case.rb
require 'desk_api'
DeskApi.configure do |config|
config.username = 'me@support.com'
config.password = 'MyReallySecretPassword'
config.subdomain = 'syncmade'
end
DeskApi.cases.create({
type: 'qna',
@tstachl
tstachl / rauth_test.py
Created Apr 4, 2014
RAuth example with desk.com
View rauth_test.py
from rauth import OAuth1Session
import pprint
try:
read_input = raw_input
except NameError:
read_input = input
session = OAuth1Session('YOUR_CONSUMER_KEY',
'YOUR_CONSUMER_SECRET',
@tstachl
tstachl / multipass.cs
Last active Aug 29, 2015
C# Multipass example for Desk.com
View multipass.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Security.Cryptography;
using System.IO;
using System.Web;
using System.Diagnostics;
using System.DirectoryServices;
@tstachl
tstachl / CaseThemeAddition.html
Created Jun 20, 2014
This is some javascript and css code that allows you to have tabbed email and note replies in desk.com.
View CaseThemeAddition.html
<script>
$(function() {
var tid = $('#tabs .ui-state-active a').attr('href').replace('#tabs-tid_', '')
, sel = '#email_reply_div_tid_' + tid
setTimeout(function() {
$(sel).prepend([
'<div>',
' <ul class="reply-toggle">',
' <li class="active">',
You can’t perform that action at this time.