It allows you to do the following at a high level:
- Control the behavior of the widget
- Listen for events in the widget and react to them
- Poll to understand widget state
The RedpenWidget object contains the API. This object provides access to all available methods. This object will be created for you by the Redpen script loader on your page.
Open the widget. If the widget is already open or isn't currently loaded, this is a no-op.
You can also open widget from custom elements using this method.
This method returns an object with properties relating to widget status.
Throughout its lifetime, the Redpen widget will broadcast numerous events to which you can listen and reply.
Callback function invoked when the widget status changes. The function will receive the changed status which will be either active true or false.
Send custom data with the Redpen diagnostics information
Custom data are additional pieces of information that you want to send in order to identify and debug issues specific to your product or application. You can send custom data when issues are created with Redpen.
There are two ways to send custom data:
- Static Data
- Dynamic Data
1. Static Data
Static data are the known metadata that is sent in every issue created. e.g. productId, tenantId, etc.
Add the customData JSON code inside the Redpen Widget script to send the static data as shown below:
After adding the customData in the widget script, the script will look as below:
2. Dynamic Data
Dynamic data are the metadata that is specific to the business logic of your application that you want to collect and send with every issue created. e.g. userId, application state, etc.
To collect dynamic data, you need to implement the getCustomData() method (the method must be on the same page where the Redpen widget script is added) in the application that has the business logic and returns a JSON string. Redpen widget will call the method when a user captures a screenshot or stops the screen recording to get the data.
After adding the getCustomData() method in the widget script, the script will look as below:
3. Predefined Fields
Data can be sent into predefined fields configured in your Redpen widget. We currently support the labels, that sets labels in your Jira ticket.
You can also set an Epic link automatically to the tickets that are created using the Redpen widget by following these easy steps.
- Create an Epic that you want to set if you haven't created it already.
- Create a label that will be used to indicate that a particular Epic needs to be assigned to the ticket.
- Create the Jira Rule to set the Epic according to the labels. (This document will guide you for the same)
- Configure the label in the widget
- Test the integration by creating a ticket using the Redpen web widget
We will add other common APIs incrementally. We are always excited to see how you use the API, so feel free to share your creations with us!