In this guide, we'll cover how to use Google Apps Script to fetch ticket data from Richpanel and bring it into Google Sheets, which you can then use to power your widgets in Geckoboard.
Find your Richpanel API key.
Make a copy of this Google Sheet.
Navigate to Extensions > Apps Script.
In the pop-up code window, enter your API key in two places by replacing the placeholder
'<your-richpanel-api-key>'
.Click the Save disk icon.
Click on the Run icon to run the code block.
Navigate back to your Spreadsheet and verify that the Ticket Data tab is now populated with your Richpanel ticket data.
We can now manipulate the data using queries and other functions for use in Geckoboard. For example, you could use the following array formula to display the number of tickets grouped by tag.
=QUERY(ARRAYFORMULA(FLATTEN(IFERROR(TRIM(SPLIT(SUBSTITUTE('Ticket Data'!I2:I, ",,", ","), ",")), ""))), "SELECT Col1, COUNT(Col1) WHERE Col1 <> '' AND Col1 <> '#VALUE!' GROUP BY Col1 ORDER BY COUNT(Col1) DESC LABEL Col1 'Tag', COUNT(Col1) 'Number of Tickets'", 0)
When you're ready, switch to Geckoboard and connect your sheet using our Google Sheets data source and begin building your widgets.
Script behavior
Things to keep in mind about how the script works:
The script fetches ticket data from the RichPanel API and updates the tab Ticket Data.
If you're adding the script to another sheet, you must create a sheet tab with the same 'Ticket Data' name. If you use a different name, you must modify the script accordingly.
The script has a
// ... add other fields as needed
part. The total fields are available as part of this script, but the Richpanel API offers more if you wish to make changes.
Script functions in detail
Function | Description | Notes |
| Fetches ticket data for the last 100 tickets from Richpanel's API from the list conversations endpoint. |
|
| Fetches tags from RichPanel and maps each tag ID to its name. This is part of the work explained above. |
|
| Pinpoints the row in the sheet for a given ticket ID |
|
Error handling
Errors are logged, but it won't interrupt the script.