This plugin provides a wrapper for the native iOS and Android Zendesk SDKs for integrating help center and ticket management functionality into your Cordova app.
cordova plugin add cordova-plugin-zendesk
Initializes the Zendesk SDK for usage with your application. You will need the appId, clientId, and zendeskUrl obtained when registering your application through Zendesk Support. This method must be invoked before any other plugin methods can be used.
document.addEventListener("deviceready", function() {
window.zendesk.initialize(appId, clientId, zendeskUrl);
});
Sets the Zendesk SDK to use an anonymous identity. Name and email can optionally passed as identifying information to provide more context when submitting tickets. This method must be invoked after initialize
and before any other plugin methods.
name
- The name of the user for identification purposes (optional)email
- The email of the user for identification purposes (optional)
var name = "Tyler Durden";
var email = "[email protected]";
window.zendesk.setAnonymousIdentity(name, email);
Sets the Zendesk SDK to use a specific identity.
var token = "abcdef123456";
window.zendesk.setIdentity(token);
Presents a new view for browsing help center articles for the application. The articles displayed can be filtered by category, section, and labels.
groupType
- Valid values are "category" and "section" (optional)groupIds
- An array of group category or section IDs to filter displayed articles with (optional)labels
- An array of label names to filter displayed articles with (optional)
var groupType = "category";
var groupIds = [1234, 5678];
var labels = ["mobile", "ios"];
window.zendesk.showHelpCenter(groupType, groupIds, labels);
Presents a new view for submitting a support ticket.
subject
- The subject to assign to the new ticket (optional)tags
- An array of tags to assign to the new ticket (optional)fields
- An array of pipe-delimited ID/value pairs for custom fields to assign to the new ticket (ex: "123456|abcdef") (optional)
var subject = "Widget Error";
var tags = ["mobile", "widget"];
window.zendesk.showTicketRequest(subject, tags);
Presents a new view listing a user's previously submitted tickets.
window.zendesk.showUserTickets();