# Webhook notification setup

**URL:** <https://forum.ansible.com/t/webhook-notification-setup/37979>\
**Category:** AWX Project\
**Tags:** awx, kubernetes\
**Created:** [May 12, 2023, 6:44am UTC](https://forum.ansible.com/t/webhook-notification-setup/37979 "2023-05-12T06:44:55Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vibin](https://avatars.discourse-cdn.com/v4/letter/v/2bfe46/32.png) [@Vibin](https://forum.ansible.com/u/Vibin)\
**Post date:** [May 12, 2023, 6:44am UTC](https://forum.ansible.com/t/webhook-notification-setup/37979/1 "2023-05-12T06:44:55Z")

</div>

Hello Team,

I’m looking for some guidance on setting up webhook notification in AWX. Haven’t found any relevant documentation or examples online.

My requirement is to create an incident when a job is failed in AWX, there are two mandatory fields required by the incident creation API ie; short\_description & assignment\_group.

I tried passing this info as variables via http headers but gets an error (code 417). Also, dictionary is not allowed under http headers.

I did not find any other way to pass this info to the API, has anyone figured this out ?

Any help is much appreciated.

AWX Version: 21.5.0 hosted on K8s Cluster.

Regards,  
Vibin

---

<div class="post-metadata">

**Author:** ![Vibin](https://avatars.discourse-cdn.com/v4/letter/v/2bfe46/32.png) [@Vibin](https://forum.ansible.com/u/Vibin)\
**Post date:** [May 16, 2023, 6:07am UTC](https://forum.ansible.com/t/webhook-notification-setup/37979/2 "2023-05-16T06:07:32Z")

</div>

Hello Team,

Any input is highly appreciated.

Regards,  
Vibin

---

<div class="post-metadata">

**Author:** ![AWX\_Project](https://avatars.discourse-cdn.com/v4/letter/a/eada6e/32.png) [@AWX\_Project](https://forum.ansible.com/u/AWX_Project)\
**Post date:** [May 17, 2023, 7:00pm UTC](https://forum.ansible.com/t/webhook-notification-setup/37979/3 "2023-05-17T19:00:58Z")

</div>

Can you clarify what you are attempting to do?  
Are you using a web hook notification template inside AWX and trying to send an HTTP request to an incident management system on job failure?  
If so, here is the documentation around doing that: [https://docs.ansible.com/automation-controller/latest/html/userguide/webhooks.html#payload-output](https://docs.ansible.com/automation-controller/latest/html/userguide/webhooks.html#payload-output)

-The AWX Team

---

<div class="post-metadata">

**Author:** ![Vibin](https://avatars.discourse-cdn.com/v4/letter/v/2bfe46/32.png) [@Vibin](https://forum.ansible.com/u/Vibin)\
**Post date:** [May 17, 2023, 7:29pm UTC](https://forum.ansible.com/t/webhook-notification-setup/37979/4 "2023-05-17T19:29:02Z")

</div>

Hello Team,

Thanks for the response.

Yes, you are spot on. So if I understand correctly, I should be able to send the payload using awx\_webhook\_payload variable. But where should I declare that variable ? Because in the webhook notification template, there’s only option to mention HTTP HEADERS.

I tried passing variables like below in the HTTP HEADERS section but it didn’t allow dictionary type input.

{  
extra\_vars: {  
description: test,  
group: abc  
}  
}

Does replacing extra\_vars with awx\_webhook\_payload in the above declaration work ?

Or did I get it completely wrong ?

Regards,  
Vibin

---

<div class="post-metadata">

**Author:** ![Vibin](https://avatars.discourse-cdn.com/v4/letter/v/2bfe46/32.png) [@Vibin](https://forum.ansible.com/u/Vibin)\
**Post date:** [May 20, 2023, 5:22am UTC](https://forum.ansible.com/t/webhook-notification-setup/37979/5 "2023-05-20T05:22:59Z")

</div>

Hi Team,

I tried multiple ways but couldn’t figure out how to send payload to the webhook endpoint.

Those which doesn’t need any input works fine.

Please provide your comments.

Regards,  
Vibin

---

<div class="post-metadata">

**Author:** ![Vibin](https://avatars.discourse-cdn.com/v4/letter/v/2bfe46/32.png) [@Vibin](https://forum.ansible.com/u/Vibin)\
**Post date:** [May 22, 2023, 2:18pm UTC](https://forum.ansible.com/t/webhook-notification-setup/37979/6 "2023-05-22T14:18:52Z")

</div>

Hello Team,

I was unable to find the awx\_webhook\_payload under extra\_vars of the job template as mentioned in the url.

I tried passing it manually using variables section of the job template but nothing worked.

Appreciate if you could point me in the right direction.

Regards,  
Vibin

---

<div class="post-metadata">

**Author:** ![Alex\_Shishko](https://avatars.discourse-cdn.com/v4/letter/a/e95f7d/32.png) [@Alex\_Shishko](https://forum.ansible.com/u/Alex_Shishko)\
**Post date:** [May 22, 2023, 2:34pm UTC](https://forum.ansible.com/t/webhook-notification-setup/37979/7 "2023-05-22T14:34:16Z")

</div>

Hello. Watch this video for webhook variables understanding  
[https://youtu.be/LVbFyjgwvQY](https://youtu.be/LVbFyjgwvQY)

You have to enable notification for your template with webhook

 ![image.png](https://us1.discourse-cdn.com/ansible/original/2X/6/6b8c2c553ee6747cbe3c4b68eddcef9442980c63.png)

For enabling mail notification watch this video:  
[https://youtu.be/tVoPkYfFgS4](https://youtu.be/tVoPkYfFgS4)

пт, 12 мая 2023 г. в 09:45, Vibin K Madampath \<[mm.vibin@gmail.com](mailto:mm.vibin@gmail.com)\>:

---

<div class="post-metadata">

**Author:** ![Vibin](https://avatars.discourse-cdn.com/v4/letter/v/2bfe46/32.png) [@Vibin](https://forum.ansible.com/u/Vibin)\
**Post date:** [May 23, 2023, 2:00pm UTC](https://forum.ansible.com/t/webhook-notification-setup/37979/8 "2023-05-23T14:00:08Z")

</div>

Hello Team,

I’m not looking for AWX integration with Github webhook.

Just to be very clear, am trying to create a notification template of type Webhook. I need to send couple of inputs to the target URL but unable to do so. Looking for some guidance on how to accomplish this.

Please see the screenshot below and advise.

> **(attachments)**
>
> ![image.png](https://us1.discourse-cdn.com/ansible/original/2X/6/6b8c2c553ee6747cbe3c4b68eddcef9442980c63.png)  
> ![20230523_192138.jpg](https://us1.discourse-cdn.com/ansible/original/2X/1/1a77287181027b26a2437a4e2a0bca912f43e0c4.jpeg)

---

<div class="post-metadata">

**Author:** ![AWX\_Project](https://avatars.discourse-cdn.com/v4/letter/a/eada6e/32.png) [@AWX\_Project](https://forum.ansible.com/u/AWX_Project)\
**Post date:** [May 24, 2023, 6:47pm UTC](https://forum.ansible.com/t/webhook-notification-setup/37979/9 "2023-05-24T18:47:18Z")

</div>

do you see any errors or messages related to that target URL in your k8s logs (either on task container or web containers)?

AWX Team

---

<div class="post-metadata">

**Author:** ![Vibin](https://avatars.discourse-cdn.com/v4/letter/v/2bfe46/32.png) [@Vibin](https://forum.ansible.com/u/Vibin)\
**Post date:** [May 25, 2023, 9:06am UTC](https://forum.ansible.com/t/webhook-notification-setup/37979/10 "2023-05-25T09:06:52Z")

</div>

Yes, please see the messages pasted below.

“POST /api/v2/notification\_templates/9/test/ HTTP/1.1” 202 598 “[https://awx.abc.com/](https://awx.abc.com/)” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36”

POST /api/v2/notification\_templates/9/test/ =\> generated 598 bytes in 207 msecs (HTTP/1.1 202) 15 headers in 620 bytes (1 switches on core 0)

DEBUG [5ba28775cf584172af70e6901e00fb39] awx.analytics.performance request: \<WSGIRequest: GET ‘/api/v2/notifications/3873/’\>, response\_time: 0.219s

“GET /api/v2/notifications/3873/ HTTP/1.1” 200 852 “[https://awx.abc.com/](https://awx.abc.com/)” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36”

GET /api/v2/notifications/3873/ =\> generated 852 bytes in 222 msecs (HTTP/1.1 200) 14 headers in 580 bytes (1 switches on core 0)

{  
“id”: 3873,  
“type”: “notification”,  
“url”: “/api/v2/notifications/3873/”,  
“related”: {  
“notification\_template”: “/api/v2/notification\_templates/9/”  
},  
“summary\_fields”: {  
“notification\_template”: {  
“id”: 9,  
“name”: “test”,  
“description”: “”  
}  
},  
“created”: “2023-05-25T08:32:25.014485Z”,  
“modified”: “2023-05-25T08:32:25.014505Z”,  
“notification\_template”: 9,  
**“error”: “Header part ({‘short\_description’: ‘Test Incident’, ‘assignment\_group’: ‘A106’}) from {‘extra\_vars’: {‘short\_description’: ‘Test Incident’, ‘assignment\_group’: ‘A106’}} must be of type str or bytes, not \<class ‘dict’\>”,**  
“status”: “failed”,  
“notifications\_sent”: 0,  
“notification\_type”: “webhook”,  
“recipients”: “[https://servicenow-API.abc.com/api/dabas/incident\_api/create/incident](https://servicenow-API.abc.com/api/dabas/incident_api/create/incident)”,  
“body”: {  
“body”: “Test Notification 9 [https://awx.abc.com/](https://awx.abc.com/)”  
}  
}

Regards,  
Vibin

---

<div class="post-metadata">

**Author:** ![AWX\_Project](https://avatars.discourse-cdn.com/v4/letter/a/eada6e/32.png) [@AWX\_Project](https://forum.ansible.com/u/AWX_Project)\
**Post date:** [May 26, 2023, 5:13pm UTC](https://forum.ansible.com/t/webhook-notification-setup/37979/11 "2023-05-26T17:13:58Z")

</div>

The error you are getting (must be of type str or bytes not \<class ‘dict’\>) is because that setting expects a dictionary of string: string. i.e.  
{  
“header1”: “value1”,  
“header2”: “value2”  
}

But you have:  
{  
“extra\_vars”: {…}  
}

So you are attempting to set the extra\_vars header as a dict, not a string.  
You may want to do something like:  
{  
“short\_description”: “Test Incident”,  
“assignment\_group”: “A106”  
}

That should give you two headers set to two different values. If you really need to merge the values into a single header, you will need to look at the docs for what you are calling into and see how they allow for that.

-The AWX Team

---

<div class="post-metadata">

**Author:** ![Vibin](https://avatars.discourse-cdn.com/v4/letter/v/2bfe46/32.png) [@Vibin](https://forum.ansible.com/u/Vibin)\
**Post date:** [May 29, 2023, 7:24am UTC](https://forum.ansible.com/t/webhook-notification-setup/37979/12 "2023-05-29T07:24:17Z")

</div>

Hi,

This is the way I call the API directly and it works - curl -k -u svcaccount -X POST -H “Content-Type: application/json” [https://servicenow-API.abc.com/api/dabas/incident\_api/create/incident](https://servicenow-API.abc.com/api/dabas/incident_api/create/incident) -d ‘{ “short\_description”: “Test Incident”, “assignment\_group”: “A106” }’

But when I pass it as two headers set to two different values also, it doesn’t take and throws error 417 which means the API didn’t get the payload what it was looking for.

So the question is how should we pass this payload in a way that the target API understands it correctly.

{

“short\_description”: “Test Incident”,  
“assignment\_group”: “A106”  
}

**Error:**

{  
“id”: 4006,  
“type”: “notification”,  
“url”: “/api/v2/notifications/4006/”,  
“related”: {  
“notification\_template”: “/api/v2/notification\_templates/9/”  
},  
“summary\_fields”: {  
“notification\_template”: {  
“id”: 9,  
“name”: “test”,  
“description”: “”  
}  
},  
“created”: “2023-05-29T07:14:35.629791Z”,  
“modified”: “2023-05-29T07:14:35.629806Z”,  
“notification\_template”: 9,  
“error”: “Error sending webhook notification: 417”,  
“status”: “failed”,  
“notifications\_sent”: 0,  
“notification\_type”: “webhook”,  
“recipients”: “[https://servicenow-API.abc.com/api/dabas/incident\_api/create/incident](https://servicenow-API.abc.com/api/dabas/incident_api/create/incident)”,  
“body”: {  
“body”: “Test Notification 9 [https://awx.abc.com/](https://awx.abc.com/)”  
}  
}

Regards,  
Vibin

---

<div class="post-metadata">

**Author:** ![Vibin](https://avatars.discourse-cdn.com/v4/letter/v/2bfe46/32.png) [@Vibin](https://forum.ansible.com/u/Vibin)\
**Post date:** [June 3, 2023, 4:05pm UTC](https://forum.ansible.com/t/webhook-notification-setup/37979/13 "2023-06-03T16:05:59Z")

</div>

Hello Team,

Any further inputs is much appreciated.

Regards,  
Vibin

---

<div class="post-metadata">

**Author:** ![Vibin](https://avatars.discourse-cdn.com/v4/letter/v/2bfe46/32.png) [@Vibin](https://forum.ansible.com/u/Vibin)\
**Post date:** [June 13, 2023, 6:58am UTC](https://forum.ansible.com/t/webhook-notification-setup/37979/14 "2023-06-13T06:58:29Z")

</div>

Hi Team,

Did you get a chance to check on this?

Just wondering whether this is a bug, because the feature is neither working as expected nor any clear documentation is available.

Would you like me to raise this as a bug.

Regards,  
Vibin

---

<div class="post-metadata">

**Author:** ![AWX\_Project](https://avatars.discourse-cdn.com/v4/letter/a/eada6e/32.png) [@AWX\_Project](https://forum.ansible.com/u/AWX_Project)\
**Post date:** [June 14, 2023, 6:46pm UTC](https://forum.ansible.com/t/webhook-notification-setup/37979/15 "2023-06-14T18:46:25Z")

</div>

> From your curl command posted:  
> curl -k -u svcaccount -X POST -H “Content-Type: application/json” [https://servicenow-API.abc.com/api/dabas/incident\_api/create/incident](https://servicenow-api.abc.com/api/dabas/incident_api/create/incident) -d ‘{ “short\_description”: “Test Incident”, “assignment\_group”: “A106” }’

The -d is not a header, its a data sent via the HTTP POST body. Please look at the previously supplied documentation to see if there is a way to send post data with a webhook notification.

-The AWX Team.

---

<div class="post-metadata">

**Author:** ![Vibin](https://avatars.discourse-cdn.com/v4/letter/v/2bfe46/32.png) [@Vibin](https://forum.ansible.com/u/Vibin)\
**Post date:** [June 20, 2023, 1:40pm UTC](https://forum.ansible.com/t/webhook-notification-setup/37979/16 "2023-06-20T13:40:32Z")

</div>

Hi,

The mentioned documentation talks about the integration of github webhook with AWX and nothing about the webhook type notification template. Also, there is no field/option to send the data/payload to the webhook url in the GUI.

AFAIK, with the current setup there is no possibility to send data/payload to the webhook type notification url and this should be a feature to get added in future releases. Also, more meaningful error messages will be helpful.

Regards,  
Vibin
