Templates

To post to the various services that it supports, Shotputter uses handlebars templates that are specified in the browser configuration. These templates can be either a string, or a function that returns a string, which has access to the following variables.

  • logs array of string Logs if enabled by the captureLogs setting in the browser configuration.
  • logsString string Logs concatenated as a single string with new lines bewtween.
  • metadata object Any metadata that was provided by the user.
  • metadataString string JSON.stringified metadata if provided
  • systemInfo object System information such as screen size, browser, etc.
  • systemInfoString string JSON.stringified systemInfo.
  • message string The message that was typed in by the user taking the screenshot.

Ex:

const {Shotput} = require("@shotputter/browser");
Shotput({
    service: {
        "url": "https://api.example.com",
        "template": `
         reported this issue on the page  
        
        `
    }
});