Think gadgets are the bees knees? You can create your own for Inspector. You currently have two choices: create a gadget that anyone with a UserVoice account can use, or create a gadget just for yourself. In both cases, you host the gadget on your server, and in both cases, you use the same request/response protocol.
I will first describe how to write a gadget as if you intend to let UserVoice admin use it. Then I’ll show how you can add a one-off gadget.
Creating A Gadget Anyone Can Use
You want to implement a gadget and distribute it to others. Maybe you run a CRM SaaS app like pennycrm.com, or maybe you’re a 3rd party and you want to implement a gadget on their behalf. You want an admin on UserVoice.com to go here:
After they add your gadget, it should show up here:
There’s two steps to this process. First, implement an endpoint on your server according to our gadget specification. Second, tell us about it and we can work with you to add it into our UI for others to use.
Implement an endpoint that will serve the gadget HTML. It can be anything you’d like, so long as it’s SSL. For instance, you might pick:
UserVoice will call this endpoint with the following parameters:
1 2 3 4 5 6 7 8
In order to handle authentication and account-specific scoping, you might want to accept additional parameters that UserVoice admins supply.
You can choose anything you want, and name these parameters what you want. So you might pick account and api_token, for instance. These parameters will be merged into the default parameters, like this:
1 2 3 4 5 6 7 8 9 10
UserVoice will then form all of this into a GET request:
GET https://email@example.com&user_id=234& ...
To which you reply with…
You need to render an HTML page.
For CSS, we recommend you use our CSS file. You can do whatever you want here, but obviously something that looks like it fits in is ideal. Our base gadget styles are here:
If your gadget has no data to display, for instance if the user can’t be found in your CRM, then the best practice is to hide the gadget completely. You can do this simply by including this snippet before you include the gadget.js file:
1 2 3
Here is a sample HTML document that you might render. It uses ERB and assumes you have a variable named ‘data’:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
Now that you’ve gotten your gadget working, you want anyone to be able to access it. Please email us at firstname.lastname@example.org and we’ll work with you on getting it added into the UserVoice UI so anyone can add it!
Create a One-Off Gadget
Let’s say you run a website called clawstores.com. Most likely, you have a database and a secret admin area you can access to view who signed up on your site. You’d like a gadget that can pull in customer data into UserVoice. Obviously, this gadget only applies to you – you don’t want any other UserVoice account access to it!
This situation is fully supported. You’ll want to head on over to your UserVoice account’s admin area, click Settings, and go into Integrations. Add a custom gadget:
Then enter your gadget URL:
Your URL might be something like:
UserVoice will then call your endpoint, including the parameters (such as email and user_id) listed above in the previous section.
It should be noted that you can use this method to test out a broader integration.
So, you’ve learned how to pull in data from your personal system and from popular 3rd party systems. Please let us know if you create generic gadgets that others might find useful!