# Curl to watcher webhook

**URL:** <https://discuss.elastic.co/t/curl-to-watcher-webhook/123958>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-alerting\
**Created:** [March 14, 2018, 5:14pm UTC](https://discuss.elastic.co/t/curl-to-watcher-webhook/123958 "2018-03-14T17:14:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![annk](https://avatars.discourse-cdn.com/v4/letter/a/c68b51/32.png) [@annk](https://discuss.elastic.co/u/annk)\
**Post date:** [March 14, 2018, 5:14pm UTC](https://discuss.elastic.co/t/curl-to-watcher-webhook/123958/1 "2018-03-14T17:14:54Z")

</div>

I have a curl post operation which uses OTRS REST API to create tickets . I want to integrate the same using watcher webhook .

These are the parameters required to create a ticket in OTRS

{  
"UserLogin" : "admin",  
"Password" : "admin",  
"Ticket" : {  
"Title" : "test",  
"CustomerUser" :"Customer1",  
"Queue" : "Raw",  
"State" : "New",  
"Priority" : "1 very low"  
},  
"Article" : {  
"CommunicationChannelID" : "1",  
"Subject" : "Test",  
"Body" : "This is a test10 ",  
"ContentType" : "text/plain; charset=utf8"  
}

}

How do I use the same params inside a webhook ? I tried this

"my\_webhook": {  
"webhook": {  
"scheme": "http",  
"host": "[example.com](http://example.com)",  
"port": 80,  
"method": "post",  
"path": "/otrs/nph-genericinterface.pl/Webservice/GenericTicketConnectorREST/Ticket",  
"headers": {"Content-Type": "application/json" },  
"body": {  
"UserLogin" : "admin",  
"Password" : "admin",  
"Ticket" : {  
"Title" : "test",  
"CustomerUser" :"Customer1",  
"Queue" : "Raw",  
"State" : "New",  
"Priority" : "1 very low"  
},  
"Article" : {  
"CommunicationChannelID" : "1",  
"Subject" : "Test",  
"Body" : "This is a test10 ",  
"ContentType" : "text/plain; charset=utf8"  
}  
}  
}  
}

But I am getting errors like this

**Watcher: [illegal\_argument\_exception] [script] unknown field [UserLogin], parser not found**

---

<div class="post-metadata">

**Author:** ![chrisronline](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chrisronline/32/28230_2.png) [@chrisronline](https://discuss.elastic.co/u/chrisronline)\
**Post date:** [March 15, 2018, 7:56pm UTC](https://discuss.elastic.co/t/curl-to-watcher-webhook/123958/2 "2018-03-15T19:56:36Z")

</div>

Pinging @spinscale for his thoughts on this one

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [March 15, 2018, 8:44pm UTC](https://discuss.elastic.co/t/curl-to-watcher-webhook/123958/3 "2018-03-15T20:44:29Z")

</div>

the `body` field needs to be a string right now.

However you can create a proper payload via a script in the transform of the webhook action, and then use the `toJson` mustache helper, which creates JSON. There is an example in the docs [https://www.elastic.co/guide/en/x-pack/6.2/actions-webhook.html](https://www.elastic.co/guide/en/x-pack/6.2/actions-webhook.html)

---

<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:** [April 12, 2018, 8:44pm UTC](https://discuss.elastic.co/t/curl-to-watcher-webhook/123958/4 "2018-04-12T20:44:35Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
