The SendSafely Portal Widget can be used in conjunction with Zendesk Ticket Forms to enable SendSafely uploads only for selected ticket categories. The configuration described in this article is designed to invoke the SendSafely Portal Widget under the following two scenarios:
Scenario 1: A specific Ticket Form is being used by a customer to submit a new request.
Every custom form as a "ticket_form_id" parameter in the URL that identifies the custom form. You should see this parameter in the address bar when you load the custom form (ie. ticket_form_id=135407). This value changes between sandbox and production environments, but remains constant once the form is created (even if re-named).
Scenario 2: The customer is replying to a ticket that was submitted using a specific Ticket Form
For cases where a user is replying to a ticket created with a custom form, the ticket_form_id not disclosed within the user interface. In order to address this, we recommend adding a custom form field with a unique name (ie "Submitted using XYZ Form") and then adding that field as a "read-only + visible" field to the form. The user won't see the field when submitting the ticket, but when they go to reply later on the name of the field will be included on the sidebar of the page along with the other ticket attributes (status, priority, etc). No value needs to ever be assigned to the field, only its name is used as a unique string to search on in order to figure out if the form needs to be protected or not.
Implementation Steps
This example assumes that 123456 is the form ID for the "Default Ticket Form" and that you already have the SendSafely Portal widget implemented and active for all incoming tickets.
Note: For security reasons, the best way to implement the above logic is to specifically exclude the "Default Ticket Form" from SendSafely (opt-out) rather than specifically include the Custom form you want to protect (opt-in). The code below uses the opt-in method and is designed to exclude the "Default Ticket Form" from your sandbox.
Step 1: Create a custom form field named "Submitted using Default Ticket Form" and add the field to the Default Ticket Form. Make sure the field properties are set to "Visible" and "Not Editable".
Step 2: Replace the existing SendSafely Javascript code in your site template with the following code:
//SendSafely app
var apiKey = 'INSERT_API_KEY_HERE';
//Create a new instance.
var sendsafely = new SendSafelyZendesk(apiKey);
if( window.location.search.indexOf('ticket_form_id=123456') > 0) {
//Exclude this form ID (Default Ticket Form), don't initialize SendSafely
} else if ($(document).text().indexOf("Submitted using Default Ticket Form") > 0) {
//Exclude pages with this string, don't initialize SendSafely
} else {
//All other pages should use SendSafely
sendsafely.initialize();
}
//End SendSafely app