Custom recipes

Some services Bugsee integrates with are highly customizable (e.g Jira). Bugsee provides a mechanism to fully customize individual fields and creation of custom field mapping for such integrations.

Edit recipes

Custom recipes are written in JavaScript, the system provides a full context (issue details, environment) as the input and expects a specific object on the output. Example of a recipe for Jira that populates specific Jira specific fields:

function fields(context) {
    const issue = context.issue;
    const device = context.device;
    const platform = context.platform;
    let summary;

    // Change summary string based on the type of the issue
    if (issue.type == 'crash') {
        summary = `CRASH: ${issue.key}: ${issue.summary || 'No summary'}`
    } else {
        summary = `USER BUG: ${issue.key}: ${issue.summary || 'No summary'}`
    }

    let description = issue.description || '';
    if (description) {
        // Add two newlines to separate other data from the description
        description += '\n\n';
    }

    if (issue.reporter) {
        description += `Reported by ${issue.reporter}\n`;
    }

    description += `Device: ${device.manufacturer} ${device.model}\n`;
    description += `OS: ${platform.version} (${platform.build})\n`;


    description += `View full Bugsee session at: ${issue.url}`;

    return {
        summary: summary,
        description: description,
        custom: {
            components: [{id: 1234}], // Automatically set Jira component
        }
    };
}

The basic structure of a recipe is:

function fields(context) {
    // ....

    return {
        // return object with fields that needs to be overriden
        // allowed properties: 'summary', 'description', 'reporter', 'priority'
        custom: {
            // custom, service specific fields, refer to a documentation of a particular service for custom fields
            // for a specific service.
        }
    };
}

Context

The input to the fields() method is a full context of the issue about to be created:

{
    issue: {
        type: 'bug', // Type of the issue, 'bug', 'crash' or 'error'
        key: 'IOS-123', // Unique key of the issue,
        summary: 'Something does not work', // Short summary of the issue
        description: '', // Description of the issue,
        created_on: '2017-01-19 23:29:32.021Z', // Date of creation
        url: 'https://app.bugsee.com/IOS/IOS-123', // URL of the issue
        priority: 5, // Priority of the issue
        attributes: {
            // Session/user attributes
        }
    },
    app: {
        name: 'My Awesome App', // Application name
        version: '1.0.2',
        build: '12345'
    },
    device: {
        name: 'My precious',
        manufacturer: 'Samsung',
        model: 'GT-1656',
        model_name: 'Samsung Galaxy S6'
    },
    platform: {
        type: 'android', // Type: 'ios', 'android'
        version: '7.2.3', // OS version
        build: 'BG1234', // OS build
        release: 'Nougat' // Release name
    }
}