Skip to content

Instantly share code, notes, and snippets.

View DeskWOW's full-sized avatar

Desk.com Customer WOW Team DeskWOW

View GitHub Profile
@DeskWOW
DeskWOW / gist:50db422b895c0bb6ab3a
Last active August 29, 2015 14:03
Custom Desk.com Email Widget Embed Code
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
</head>
<body>
<style>
a.form-link {
display: block;
box-sizing: border-box;
@DeskWOW
DeskWOW / gist:7ca1ec164b1671faea34
Created July 9, 2014 12:03
How to correctly render right-to-left languages like Arabic. This code should be placed at the very top of Layout within the Desk.com Advanced Theme editor for your current Default support center web theme.
{% if desk.system.language == "ar" %}
<style> body { direction:rtl; } </style>
{% endif %}
require 'desk_api'
ticket = DeskApi.cases.create({
external_id: 123456,
subject: 'Subject',
description: 'Description',
priority: 1,
status: 'resolved',
type: 'email',
labels: ['Label 1', 'Label 2'],
@DeskWOW
DeskWOW / gist:b8116592d6d037b62983
Last active August 29, 2015 14:04
On My Profile page of your support center, replace default 'verified' icon (http://screencast.com/t/SCw9NPXs) with a different icon (http://take.ms/tEyLb)
<script>$(function() { $(".verified img").prop("src", "http://i.imgur.com/7zvSABZ.png") });</script>
@DeskWOW
DeskWOW / gist:e179925743819a19ff7e
Created August 3, 2014 19:42
Add this to the bottom of your "Chat Connected Screen" theme to automatically redirect users to your email form if they've waited over 3 minutes for an agent to accept their chat.
<script>
var timeout = 180000;
var redirectTo = "/customer/portal/emails/new";
setTimeout('redirectToEmail()', timeout)
function redirectToEmail()
{
if( "none" == $("#chat_send_area").css('display')) {
alert("We're sorry, but we are no longer available to chat at this time. To leave us a note, just fill out the contact form on the next screen.");
window.top.location.href = redirectTo;
}
@DeskWOW
DeskWOW / gist:04161fe80e0b1d4f86ac
Created August 5, 2014 14:46
How to change article rating to "Was this helpful? Yes / No" on one line. Result: http://take.ms/SuQdD
<!-- Replace this: -->
{{ rate_block }}
<!-- with this: -->
<style>
#rate_article a {
text-decoration: none;
}
@DeskWOW
DeskWOW / gist:6e88c4d09174b37da885
Created August 6, 2014 01:35
By adding a bit of code to "Email (New)", you can set a customer custom field to the user's timezone. Before adding code to your support center theme's contact form, create a customer custom field with key "time_zone" and with the 4 values used below.
<!-- Add this right above {{form_end}} -->
<div class="timezone-div">{{ customer_custom_time_zone }}</div>
@DeskWOW
DeskWOW / gist:a291e186aa7408255f57
Created August 6, 2014 13:30
Private Portal — Require specific user email address domain to allow support center access
{% unless current_user == nil or current_user.is_guest %}
{% assign email_domain = current_user.customer.email | split: '@' %}
{% if email_domain[1] contains "sitechcs.com" %}
Success! You'll want ALL code currently in your 'Layout' to go here so the site loads.
{% else %}
If the user sees this text, it means they logged in, but their email domain isn't approved.
{% endif %}
{% else %}
If the user sees this text, it means they are not logged in. So you'll likely want to prompt them to login or auto redirect them to login page here.
{% endunless %}
@DeskWOW
DeskWOW / gist:30b0bc339ba1a4a8e840
Created August 6, 2014 13:34
Private Portal — Require manual user (customer) approval to allow support center access
{% unless current_user == nil or current_user.is_guest %}
{% if current_user.customer.custom_portal_access == "true" || current_user.customer.custom_portal_access == true || current_user.customer.custom_portal_access == "1" || current_user.customer.custom_portal_access == 1 %}
Success! You'll want ALL code currently in your 'Layout' to go here so the site loads.
{% else %}
If the user sees this text, it means they logged in, but not manually approved.
{% endif %}
{% else %}
If the user sees this text, it means they are not logged in. So you'll likely want to prompt them to login or auto redirect them to login page here.
{% endunless %}
@DeskWOW
DeskWOW / gist:eddd9112b999873a6675
Created August 21, 2014 00:04
A custom case theme that evaluates to, cc, and bcc addresses in agent.
<div class="agent_ticket_section">
{{csat}}
</div>
<div class="agent_ticket_section">
{{subject}}