This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
desk.ready(function() { | |
desk.interaction.ajax('/api/v2/customers/search?email=tstachl%40salesforce.com', { | |
method: 'GET', | |
callback: function(data) { | |
if (data.status === 200 && data.payload.total_entries > 0) { | |
var customer = data.payload.entries.first; | |
desk.interaction.screenPop(customer.id, 'object=customer', function(response) { | |
if (response.result) { | |
alert('screenPop successful.'); | |
} else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def parse_signed_request(request, max_age=3600) | |
# Split the signed request on the first period. The result is two strings: the hashed Based64 context signed with the consumer secret and the Base64 encoded context itself. | |
encoded_sig, enc_envelope = request.split('.', 2) | |
envelope = JSON.parse(base64_url_decode(enc_envelope)).with_indifferent_access # Needs ActiveSupport | |
algorithm = envelope[:algorithm] | |
# ADDITIONAL: Check the algorithm is HMAC SHA-256 | |
if algorithm != 'HMACSHA256' | |
raise 'Invalid request. (Unsupported algorithm.)' | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
var resolve = require('path').resolve | |
, connect = require('connect') | |
, https = require('https') | |
, fs = require('fs'); | |
var server = connect() | |
, path = resolve('.') | |
, port = process.env['PORT'] || 3000; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% 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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |