# Jira Alert in Watcher

**URL:** https://discuss.elastic.co/t/jira-alert-in-watcher/33877
**Category:** Elasticsearch
**Tags:** elastic-stack-alerting
**Created:** [November 5, 2015, 2:42pm UTC](https://discuss.elastic.co/t/jira-alert-in-watcher/33877 "2015-11-05T14:42:33Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![SuperPringles](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/superpringles/32/5303_2.png) [@SuperPringles](https://discuss.elastic.co/u/SuperPringles)
#### Post date: [November 5, 2015, 2:42pm UTC](https://discuss.elastic.co/t/jira-alert-in-watcher/33877/1 "2015-11-05T14:42:33Z")

</div>

The product page of Watcher mentions the option to alert Jira.

> Get Notified the Way You Want  
> Easily set up email alerts when incidents occur, or integrate Watcher into your existing monitoring infrastructure via webhook to send alerts to JIRA, HipChat, PagerDuty, Slack, and more.

I can't seem to find how to do this and how it works. I found ElastAlert on the internet and this is able to create tickets in Jira or even update a ticket. Can Watcher do this also? How does it work 😄?

Thanks!

---

<div class="post-metadata">

### Author: ![skearns](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/skearns/32/125945_2.png) [@skearns](https://discuss.elastic.co/u/skearns)
#### Post date: [November 5, 2015, 3:05pm UTC](https://discuss.elastic.co/t/jira-alert-in-watcher/33877/2 "2015-11-05T15:05:01Z")

</div>

You can use the [WebHook](https://www.elastic.co/guide/en/watcher/current/actions.html#actions-webhook) action to integrate with any 3rd party service that has an RESTful API, including [Jira](https://docs.atlassian.com/jira/REST/latest/). We are planning a more native integration, which will make it a bit simpler, but you should be able to integrate with Jira today.

---

<div class="post-metadata">

### Author: ![uboness](https://avatars.discourse-cdn.com/v4/letter/u/96bed5/32.png) [@uboness](https://discuss.elastic.co/u/uboness)
#### Post date: [November 5, 2015, 3:10pm UTC](https://discuss.elastic.co/t/jira-alert-in-watcher/33877/3 "2015-11-05T15:10:10Z")

</div>

Currently this can be done using the `webhook` action. This action enables you to create a generic HTTP request to an external service. For example, if you enable [JIRA API](https://developer.atlassian.com/jiradev/jira-apis/jira-rest-apis). Here's an example action that create a jira issue (using the same example as in JIRA docs):

```
{
  ...,

  "actions" : {
    "create_jira_issue" : {
      "webhook" : {
        "host" : "localhost",
        "port" : 2990,
        "method" : "post",
        "path" : "/jira/rest/api/2/issue"
        "auth" : {
          "basic" : {
            "username" : "admin",
            "password" : "admin"
          }
        },
        "body" : {
          "fields": {
            "project": {
              "id": "10000"
            },
            "summary": "No REST for the Wicked.",
            "description": "Creating of an issue using ids for projects and issue types using the REST API",
            "issuetype": {
              "id": "3"
            }
          }
        }
      }
    }
  }
}

```

---

<div class="post-metadata">

### Author: ![SuperPringles](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/superpringles/32/5303_2.png) [@SuperPringles](https://discuss.elastic.co/u/SuperPringles)
#### Post date: [November 6, 2015, 3:42pm UTC](https://discuss.elastic.co/t/jira-alert-in-watcher/33877/4 "2015-11-06T15:42:02Z")

</div>

Interesting! I might be mistaken but wouldn't that just make a thin jira issue? It wouldn't really have a lot of information regarding the issue. I haven't been able to find something for it yet but isn't it possible to add data or logs to it?

---

<div class="post-metadata">

### Author: ![uboness](https://avatars.discourse-cdn.com/v4/letter/u/96bed5/32.png) [@uboness](https://discuss.elastic.co/u/uboness)
#### Post date: [November 6, 2015, 5:48pm UTC](https://discuss.elastic.co/t/jira-alert-in-watcher/33877/5 "2015-11-06T17:48:52Z")

</div>

The example above is simply the same example as in their [intro doc](https://developer.atlassian.com/jiradev/jira-apis/jira-rest-apis)... only within a watch. Their API for [creating an issue](https://docs.atlassian.com/jira/REST/latest/#api/2/issue) is much richer than that though. The webhook body can be [templated](https://www.elastic.co/guide/en/watcher/current/scripts-templates.html#templates) as well.

---

<div class="post-metadata">

### Author: ![SuperPringles](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/superpringles/32/5303_2.png) [@SuperPringles](https://discuss.elastic.co/u/SuperPringles)
#### Post date: [November 9, 2015, 8:28am UTC](https://discuss.elastic.co/t/jira-alert-in-watcher/33877/6 "2015-11-09T08:28:38Z")

</div>

I see! Thanks! 😄

---

<div class="post-metadata">

### Author: ![nellicus](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nellicus/32/51566_2.png) [@nellicus](https://discuss.elastic.co/u/nellicus)
#### Post date: [March 14, 2016, 4:31am UTC](https://discuss.elastic.co/t/jira-alert-in-watcher/33877/7 "2016-03-14T04:31:25Z")

</div>

The above values for the HTTP response body doesn't work

`{ "error": { "root_cause": [{ "type": "parse_exception", "reason": "unexpected field [fields]" } ], "type": "parse_exception", "reason": "could not parse [webhook] action [myalert]. failed parsing http request template", "caused_by": { "type": "parse_exception", "reason": "could not parse http request template. could not parse value for [body] field", "caused_by": { "type": "parse_exception", "reason": "unexpected field [fields]" } } }, "status": 400 }`

we just allow static text or mustache templates right? @uboness  
Or am I missing something here?

---

<div class="post-metadata">

### Author: ![uboness](https://avatars.discourse-cdn.com/v4/letter/u/96bed5/32.png) [@uboness](https://discuss.elastic.co/u/uboness)
#### Post date: [April 12, 2016, 7:03pm UTC](https://discuss.elastic.co/t/jira-alert-in-watcher/33877/8 "2016-04-12T19:03:36Z")

</div>

no, you're not missing something, indeed the `body` field should be a templated string, not an object (with all the json parts escaped).. not ideal... we should look into it to see how we can simplify this (perhaps with an alternative `jsonBody` field)

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [July 6, 2017, 1:45pm UTC](https://discuss.elastic.co/t/jira-alert-in-watcher/33877/9 "2017-07-06T13:45:59Z")

</div>


