Version: v0.0.0-...-babb74f Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Apr 13, 2022 License: Apache-2.0 Imports: 18 Imported by: 0



Package jira implements a command and webhook service for interacting with JIRA.

The service adds !commands and issue expansions, in addition to JIRA webhook support.



View Source
const ServiceType = "jira"

ServiceType of the JIRA Service


This section is empty.


This section is empty.


type Service

type Service struct {

	// The user ID to create issues as, or to create/delete webhooks as. This user
	// is also used to look up issues for expansions.
	ClientUserID id.UserID
	// A map from Matrix room ID to JIRA realms and project keys.
	Rooms map[id.RoomID]struct {
		// A map of realm IDs to project keys. The realm IDs determine the JIRA
		// endpoint used.
		Realms map[string]struct {
			// A map of project keys e.g. "SYN" to config options.
			Projects map[string]struct {
				// True to expand issues with this key e.g "SYN-123" will be expanded.
				Expand bool
				// True to add a webhook to this project and send updates into the room.
				Track bool
	// contains filtered or unexported fields

Service contains the Config fields for the JIRA service.

Before you can set up a JIRA Service, you need to set up a JIRA Realm.

Example request:

    Rooms: {
        "!qmElAGdFYCHoCJuaNt:localhost": {
            Realms: {
                "jira-realm-id": {
                    Projects: {
                        "SYN": { Expand: true },
                        "BOTS": { Expand: true, Track: true }

func (*Service) Commands

func (s *Service) Commands(cli types.MatrixClient) []types.Command

Commands supported:

!jira create KEY "issue title" "optional issue description"

Responds with the outcome of the issue creation request. This command requires a JIRA account to be linked to the Matrix user ID issuing the command. It also requires there to be a project with the given project key (e.g. "KEY") to exist on the linked JIRA account. If there are multiple JIRA accounts which contain the same project key, which project is chosen is undefined. If there is no JIRA account linked to the Matrix user ID, it will return a Starter Link if there is a known public project with that project key.

func (*Service) Expansions

func (s *Service) Expansions(cli types.MatrixClient) []types.Expansion

Expansions expands JIRA issues represented as:


Where "KEY" is the project key and 12" is an issue number. The Service Config will be used to map the project key to a realm, and subsequently the JIRA endpoint to hit. If there are multiple projects with the same project key in the Service Config, one will be chosen arbitrarily.

func (*Service) OnReceiveWebhook

func (s *Service) OnReceiveWebhook(w http.ResponseWriter, req *http.Request, cli types.MatrixClient)

OnReceiveWebhook receives requests from JIRA and possibly sends requests to Matrix as a result.

func (*Service) Register

func (s *Service) Register(oldService types.Service, client types.MatrixClient) error

Register ensures that the given realm IDs are valid JIRA realms and registers webhooks with those JIRA endpoints.

Source Files


Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL