Skip to content

Instantly share code, notes, and snippets.

View tstachl's full-sized avatar

Thomas Stachl tstachl

  • Pilina
  • Remote
View GitHub Profile
@tstachl
tstachl / desk_multipass.php
Last active April 23, 2017 03:16
WordPress - Desk.com Multipass SSO Plugin
<?php
/**
* Plugin Name: Desk.com Multipass
* Plugin URI: https://github.com/tstachl/wp-desk_multipass
* Description: A WordPress plugin to add a menu option that redirects to your Desk.com Support Site.
* Version: 1.0.0
* Author: Thomas Stachl
* Author URI: https://github.com/tstachl
* License: BSD 3-Clause License
*/
<div id="case_salesforce_section">
{{widget.salesforce.body}}
</div>
module ZendeskAPI::Middleware::Request::RetryExtension
def call(env)
super
rescue Errno::ETIMEDOUT, Timout::Error, Net::HTTPBadGateway => err
retry
end
end
class ZendeskAPI::Middleware::Request::Retry
prepend ZendeskAPI::Middleware::Request::RetryExtension
<div class="agent_company_section">
<span class="agent_company_section_label">{{ LABEL }}</span>
<div class="agent_company_section_data field_company_name">
<input class="default customer_record_input_field" type="text" value="{{ company.custom_KEY }}" disabled>
</div>
</div>
{% if article.number_of_attachments > 0 %}
<div id='attachments'>
<strong>{{system.snippets.attachments}}</strong>
<ul>
{% for attachment in article.kb_article_attachments %}
<li>
<a href="{{ attachment.faq_download_url }}" class="kb_article_attachment_a" target="_blank">{{ attachment.name }}</a>
</li>
{% endfor %}
</ul>
$ openssl s_client -connect desk.com:443
CONNECTED(00000003)
depth=1 /C=US/O=DigiCert Inc/CN=DigiCert SHA2 Secure Server CA
verify error:num=20:unable to get local issuer certificate
verify return:0
---
Certificate chain
0 s:/C=US/ST=California/L=San Francisco/O=Salesforce.com, Inc./CN=*.desk.com
i:/C=US/O=DigiCert Inc/CN=DigiCert SHA2 Secure Server CA
1 s:/C=US/O=DigiCert Inc/CN=DigiCert SHA2 Secure Server CA
@tstachl
tstachl / desk.pl
Last active August 29, 2015 14:21
Calling the Desk.com API in perl using Net::OAuth.
use strict;
use warnings;
use Net::OAuth 0.20;
use Data::Random qw(:all);
$Net::OAuth::PROTOCOL_VERSION = Net::OAuth::PROTOCOL_VERSION_1_0A;
use HTTP::Request::Common;
use LWP::UserAgent;
my $ua = LWP::UserAgent->new;
@tstachl
tstachl / create_case.rb
Created June 8, 2015 15:43
Create an outbound email case for a customer by email.
require 'desk_api' # @see https://github.com/forcedotcom/salesforce-deskcom-api
# authenticate `DeskApi` with your Desk.com instance
#####
# FIND OR CREATE CUSTOMER
#####
# you should get the customer data from your system
customer_data = {
first_name: 'John',
last_name: 'Smith',
@tstachl
tstachl / index.html
Created August 31, 2015 23:34
Updating the draft using Desk.com Canvas.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Update Draft</title>
<meta name="description" content="A Desk.com canvas app example that updates a draft.">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="//ajax.deskapi.com/libs/desk/canvas/1.0.0/desk-canvas-all.js"></script>
<script>
@tstachl
tstachl / customers.java
Created September 3, 2015 17:57
This is an untested example of how you could use the Desk.com API to fetch all customers in java.
// Use:
// Desk client = new Desk('[email protected]', '$upp0rt!', 'https://example.desk.com');
// JSONObject[] customers = client.getAllCustomers();
class Desk {
public Desk(String username, String password, String endpoint) {
this.username = username;
this.password = password;
this.endpoint = endpoint;