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
| Below are examples of functions to get the ID a resource in Desk when it's not availabie as a value on the resource itself. | |
| There are two functions, get_resource_id() and get_collection_ids(). | |
| 1. get_resource_id(resource) | |
| - Takes one parameter, an individual resource (e.g., an article, group, etc.) which has been parsed from JSON into an object | |
| - Returns the string as a value. | |
| 2. get_collection_ids(collection) | |
| - Takes one parameter, a collection (e.g., a list or search result of articles, groups, etc.) which has been parsed from JSON into an array of objects |
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
| <!-- First, we'll wrap the entire case theme in a div and use Liquid to add the case ID to the element ID | |
| so we can be specifically target elements within this case theme with CSS (or JavaScript! :D ) --> | |
| <div id="custom_case_theme_{{case.id}}"> | |
| <style type="text/css"> | |
| /* Example of targeting an element on this specific case theme */ | |
| div#case_priority_indicator_{{case.id}} { | |
| display: inline-block; | |
| } | |
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
| NOTE: These instructions assume that you already have all of the articles that you want to import | |
| to Desk in HTML or plain text files (.html or .txt). | |
| Copy the following URL and open it in a new tab in your browser: | |
| https://gist.github.com/oheyandy/8568644/raw/001fc5a1bd07d3ff981ffc014c46594f74e5948f/sample_topic.xml | |
| On that page, click "Save As" (generally under File > Save As in your tool or menu bar) and save | |
| the file with the name of your topic (e.g., "my_topic.xml"). Repeat this process for each Topic that | |
| you plan to import. |
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
| # Create a new client, e.g., | |
| # myclient = DeskClient.new 'TOKEN', 'TOKEN_SECRET', 'CONSUMER_KEY', 'CONSUMER_SECRET', 'SUBDOMAIN' | |
| # | |
| # Make requests with GET/PUT/POST | |
| # request bodies are automatically converted to JSON, so you can pass a hash | |
| # | |
| # customer = { first_name: "andy", emails: [ { type: "home", value: "andy@desk.com"} ] } | |
| # create_customer = myclient.post '/api/v2/customers', customer | |
| # update_customer = myclient.put '/api/v2/customers/1234', { phone: '555-123-1234' } | |
| # show_customer = myclient.get '/api/v2/customer/1234' |
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 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> | |
| <!-- Copy and paste the three resources ABOVE this comment line and place them in your page header --> | |
| <!-- Copy and paste the code BELOW this comment line and place it one your page where you want the widget to display --> |
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 find_number(n) | |
| nums = [[1,3,3,4],[2,3,3,4],[5,3,3,4],[6,3,3,4],[7,3,3,4],[8,3,3,4],[9,3,3,4],[0,3,3,4]] | |
| maybes = Array.new(nums.size) { |num| nums[num].permutation.to_a.uniq! } | |
| maybes.flatten!(1).sort! | |
| "07700 90" + maybes[n-1].insert(1," ").join | |
| end | |
| def other_find_number(n) | |
| nums = [] | |
| [1,2,5,6,7,8,9,0].each { |num| nums.push([num,3,3,4].permutation.to_a.uniq!)} |
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
| Create 12 custom snippets (https://support.desk.com/customer/portal/articles/566489-using-snippets-in-your-help-center) for each month (jan, feb, mar, etc.). | |
| Below is the logic that we will use to translate the month in auto-acknowledgement by inserting a custom snippet instead of using the default "Jan", "Feb", "Mar", etc., values used by Liquid's date filter: | |
| {% assign month = case.updated_at | in_time_zone: site.timezone | date: "%b" %} | |
| {% if month == 'Jan' %}{{system.snippets.jan}}{% elsif month == 'Feb' %} | |
| {{system.snippets.feb}} | |
| {% elsif month == 'Mar' %} | |
| {{system.snippets.mar}} |
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> | |
| {% capture default_signature %} | |
| <!-- This is where the default signature text/html should go. --> | |
| {% endcapture %} | |
| {% if case.user %} | |
| {% if case.user.signature.size < 3 %} | |
| {{default_signature}} | |
| {%else%} | |
| {{case.user.signature}} | |
| {% endif %} |
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"> | |
| <!-- Replace all instances of "KEY" with the value of the fields KEY, e.g., "company.custom_interface_server". --> | |
| <!-- If you do not know the key to your field, you will need to look it up in Admin > Cases > Company > Custom Fields by clicking on the name of the custom field and referencing the "Key" field. --> | |
| <span class="agent_company_section_label label_custom label_custom_KEY"> | |
| Resolution | |
| </span> | |
| <div class="agent_company_section_data"> | |
| <!-- Inspect the source of the custom field that is automatically generated on your current case template (E.g., using Chrome's dev tools), and replace "custom1" in the id and name attributes of the div below with the correct value. --> | |
| <textarea id="company_custom1" maxlength="255" name="company[custom1]" rows="2" class="default custom_field_string" type="text" cols="40" autocomplete="off" size="100"> | |
| {{company.custom_KEY}} |
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
| <script type="text/javascript"> | |
| (function(){ | |
| setTimeout(function(){ | |
| var chat_widget = document.getElementsByClassName('a-desk-widget-chat')[0]; | |
| if (chat_widget.attributes['onclick'].value.indexOf('/customer/widget/emails/new') != -1) { | |
| var email_form = chat_widget.attributes['onclick'].textContent; | |
| var label_email = email_form.substring(0, email_form.indexOf('/emails/new?') + 12) + "ticket[labels_new]=ENTER%20YOUR%20LABEL%20HERE" + email_form.substring(email_form.indexOf('/emails/new?') + 12, email_form.length); | |
| chat_widget.attributes['onclick'].textContent = label_email; | |
| } | |
| }, 1500); |