The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Bot::Backbone::Service::Ticket - a service for doing ticket lookups and summarizing

VERSION

version 0.160490

SYNOPSIS

    # And then in your bot configuration:
    service my_tickets => (
        service  => 'Ticket',
        trackers => [{
            type       => 'JIRA',
            uri        => 'http://company.atlassian.net/',
            username   => 'botuser',
            password   => 'secret',
            title      => 'Issue %{issue}s: %{summary}s',
            link       => 'https://company.atlassian.net/browse/%{issue}s',
            patterns   => [
                qr{(?<!/)\b(?<issue>[A-Za-z]+-\d+)\b},
                qr{(?<![\[])\b(?<schema>https:)//company\.atlassian\.net/browse/(?<issue>[A-Za-z]+-\d+)\b},
            ],
        }, {
            type     => 'FogBugz',
            base_url => 'https://company.fogbugz.com/api.asp',
            token    => 'gobbledygooksecretstuff',
            title    => 'Case #%{issue}s: %{summary}s',
            link     => 'http://example.com/mytickets/issue/%{issue}s',
            patterns => [
                qr{\bbugzid:(?<issue>\d+)\b},
                qr{(?<![\[])\b(?<scheme>https:)//company\.fogbugz\.com/f/cases/(?<issue>\d+)\b},
            ]
        }],
        send_policy => 'dont_repeat_too_often',
    );

DESCRIPTION

This module is the main reason most (maybe all, actually) of my work bots began their existence: to spew out the title and link to a ticket in the ticket/issue/case tracker application used by the company. When a ticket gets mentioned, the bot looks up the ticket, grabs the title and shares it with a link to the ticket with the group. That way it's easy for someone to say, "while working on #123, I ran into X problem" and everyone can be clued into the context without having to remember the ticket numbers, but the original poster can still be precise and let others look into the ticket details easily.

To use this module, you must install one of the ticket tracking systems or build your own. As of this writing, the following trackers are implemented:

To build your own, see Bot::Backbone::Service::Ticket::Tracker. It is pretty simple.

Multiple ticket trackers can be defined in a single service configuration for simplicity. This is useful as most organizations have more than one or transition from one to another from time to time.

DISPATCHER

<mention ticket>

When one of the patterns defined in the tracker configuration matches a message received, the "name_that_method" method is called to respond.

This will trigger the "lookup_issue" in Bot::Backbone::Service::Ticket::Tracker method on the tracker which is responsible for finding the named issue in the tracking system and returning the metadata describing it. If a matching ticket is actually found, the details will be announced as a reply. If nothing is returned, the bot is silent.

ATTRIBUTES

trackers

This is a list of trackers configured for this service. At least one tracker must be defined. The type key is used to lookup the class implementing the lookup_issue method for your tracking system. It can be the full name of the class or just the last part of the name if the class name is prefixed with "Bot::Backbone::Service::Ticket::Tracker::".

METHODS

name_that_issue

Implements the issue lookup and response.

initialize

No op.

AUTHOR

Andrew Sterling Hanenkamp <hanenkamp@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2016 by Qubling Software LLC.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.