Custom notification not sent when data contains double quotes

Notification is not sent when custom data in the notification template contains a string that contains double or single quotes. I am using a webhook, that posts some data. I am also using job.artifacts to pass some data to the notification template. I have listed the two problamatic cases below.

Has anyone encountered this or is fmailiar with what is the cause for this behaviour.

Any help is highly appreciated :smiley:

AWX version

23.5.1

Ansible version

2.11.12

Operating system

CentOS

Steps to reproduce

A playbook that contains the following:

- hosts: all
  gather_facts: true

  tasks:    
    - name: "[playbook_simple_test] Test Task."
      ansible.builtin.set_stats:
        aggregate: false
        per_host: false
        data:
          "{{ data_obj }}"

      register: some_test  

The notification template contains the following:

  • Created:
{{ job_metadata }}
  • Success message body:
{
  "job.id": "{{ job.id }}",
  "job.status": "{{ job.status }}",
  "job.artifacts": "{{ job.artifacts }}"
}
  • Error message body:
{
  "job.id": "{{ job.id }}",
  "job.status": "{{ job.status }}",
  "job.artifacts": "{{ job.artifacts }}"
}

There are the following three cases in a job template:

  1. w/o double quotes ("):
    Extra-vars:
{
  "data_obj": {
    "some_str": "This contains no double quotes."
  }
}
  1. contains double quotes ("):
    Extra-vars:
{
  "data_obj": {
    "some_str": "This contains double quotes \" in the middle of text."
  }
}
  1. contains a stringified json
{
  "data_obj": {
    "some_str": "{\"key1\": \"value1\", \"key2\": \"value2\"}"
  }
}

Expected results

metadata
{“job.id”: “xxxxx”, “job.status”: “successful”, “job.artifacts”: {“some_str”: “string content”}}

Actual results

  1. w/o double quotes in string:
    metadata
    {“job.id”: “xxxxx”, “job.status”: “successful”, “job.artifacts”: {“some_str”: “This contains double quotes " in the middle of text.”}}

  2. contains double quotes ("):
    metadata
    No Notification

  3. contains stringified json:
    metadata
    No Notification

Hello @Abd we did see your GitHub Issue and this does seem to be a bug. We are continuing to triage this on your issue. Thank you for bringing this to our attention!