We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
slack 404
I'm getting the same issue as was reported here: https://github.com/ansible/ansible/issues/8669

Error output I'm getting is:

```
failed: [test-domain.com -> 127.0.0.1] => {"failed": true}
msg:  failed to send payload={"username": "toby", "text": "stage update has successfully completed", "link_names": 1, "channel": "#deploys", "icon_url": "http://www.ansible.com/favicon.ico"} to https://pixelfusion.slack.com/services/hooks/incoming-webhook?token=[obscured]: HTTP Error 404: Not Found
```


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `notification/slack.py`
Content:
```
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3 
4 # (c) 2014, Ramon de la Fuente <ramon@delafuente.nl>
5 #
6 # This file is part of Ansible
7 #
8 # Ansible is free software: you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation, either version 3 of the License, or
11 # (at your option) any later version.
12 #
13 # Ansible is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 # GNU General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with Ansible.  If not, see <http://www.gnu.org/licenses/>.
20 
21 DOCUMENTATION = """
22 module: slack
23 short_description: Send Slack notifications
24 description:
25     - The M(slack) module sends notifications to U(http://slack.com) via the Incoming WebHook integration
26 version_added: 1.6
27 author: Ramon de la Fuente <ramon@delafuente.nl>
28 options:
29   domain:
30     description:
31       - Slack (sub)domain for your environment without protocol.
32         (i.e. C(future500.slack.com))
33     required: true
34   token:
35     description:
36       - Slack integration token
37     required: true
38   msg:
39     description:
40       - Message to send.
41     required: true
42   channel:
43     description:
44       - Channel to send the message to. If absent, the message goes to the channel selected for the I(token).
45     required: false
46   username:
47     description:
48       - This is the sender of the message.
49     required: false
50     default: ansible
51   icon_url:
52     description:
53       - Url for the message sender's icon (default C(http://www.ansible.com/favicon.ico))
54     required: false
55   icon_emoji:
56     description:
57       - Emoji for the message sender. See Slack documentation for options.
58         (if I(icon_emoji) is set, I(icon_url) will not be used)
59     required: false
60   link_names:
61     description:
62       - Automatically create links for channels and usernames in I(msg).
63     required: false
64     default: 1
65     choices:
66       - 1
67       - 0
68   parse:
69     description:
70       - Setting for the message parser at Slack
71     required: false
72     choices:
73       - 'full'
74       - 'none'
75   validate_certs:
76     description:
77       - If C(no), SSL certificates will not be validated. This should only be used
78         on personally controlled sites using self-signed certificates.
79     required: false
80     default: 'yes'
81     choices:
82       - 'yes'
83       - 'no'
84 """
85 
86 EXAMPLES = """
87 - name: Send notification message via Slack
88   local_action:
89     module: slack
90     domain: future500.slack.com
91     token: thetokengeneratedbyslack
92     msg: "{{ inventory_hostname }} completed"
93 
94 - name: Send notification message via Slack all options
95   local_action:
96     module: slack
97     domain: future500.slack.com
98     token: thetokengeneratedbyslack
99     msg: "{{ inventory_hostname }} completed"
100     channel: "#ansible"
101     username: "Ansible on {{ inventory_hostname }}"
102     icon_url: "http://www.example.com/some-image-file.png"
103     link_names: 0
104     parse: 'none'
105 
106 """
107 
108 
109 SLACK_INCOMING_WEBHOOK = 'https://%s/services/hooks/incoming-webhook?token=%s'
110 
111 def build_payload_for_slack(module, text, channel, username, icon_url, icon_emoji, link_names, parse):
112     payload = dict(text=text)
113 
114     if channel is not None:
115         payload['channel'] = channel if (channel[0] == '#') else '#'+channel
116     if username is not None:
117         payload['username'] = username
118     if icon_emoji is not None:
119         payload['icon_emoji'] = icon_emoji
120     else:
121         payload['icon_url'] = icon_url
122     if link_names is not None:
123         payload['link_names'] = link_names
124     if parse is not None:
125         payload['parse'] = parse
126 
127     payload="payload=" + module.jsonify(payload)
128     return payload
129 
130 def do_notify_slack(module, domain, token, payload):
131     slack_incoming_webhook = SLACK_INCOMING_WEBHOOK % (domain, token)
132 
133     response, info = fetch_url(module, slack_incoming_webhook, data=payload)
134     if info['status'] != 200:
135         obscured_incoming_webhook = SLACK_INCOMING_WEBHOOK % (domain, '[obscured]')
136         module.fail_json(msg=" failed to send %s to %s: %s" % (payload, obscured_incoming_webhook, info['msg']))
137 
138 def main():
139     module = AnsibleModule(
140         argument_spec = dict(
141             domain      = dict(type='str', required=True),
142             token       = dict(type='str', required=True),
143             msg         = dict(type='str', required=True),
144             channel     = dict(type='str', default=None),
145             username    = dict(type='str', default='Ansible'),
146             icon_url    = dict(type='str', default='http://www.ansible.com/favicon.ico'),
147             icon_emoji  = dict(type='str', default=None),
148             link_names  = dict(type='int', default=1, choices=[0,1]),
149             parse       = dict(type='str', default=None, choices=['none', 'full']),
150 
151             validate_certs = dict(default='yes', type='bool'),
152         )
153     )
154 
155     domain = module.params['domain']
156     token = module.params['token']
157     text = module.params['msg']
158     channel = module.params['channel']
159     username = module.params['username']
160     icon_url = module.params['icon_url']
161     icon_emoji = module.params['icon_emoji']
162     link_names = module.params['link_names']
163     parse = module.params['parse']
164 
165     payload = build_payload_for_slack(module, text, channel, username, icon_url, icon_emoji, link_names, parse)
166     do_notify_slack(module, domain, token, payload)
167 
168     module.exit_json(msg="OK")
169 
170 # import module snippets
171 from ansible.module_utils.basic import *
172 from ansible.module_utils.urls import *
173 main()
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/notification/slack.py b/notification/slack.py
--- a/notification/slack.py
+++ b/notification/slack.py
@@ -105,8 +105,7 @@
 
 """
 
-
-SLACK_INCOMING_WEBHOOK = 'https://%s/services/hooks/incoming-webhook?token=%s'
+SLACK_INCOMING_WEBHOOK = 'https://hooks.slack.com/services/%s'
 
 def build_payload_for_slack(module, text, channel, username, icon_url, icon_emoji, link_names, parse):
     payload = dict(text=text)
@@ -128,11 +127,11 @@
     return payload
 
 def do_notify_slack(module, domain, token, payload):
-    slack_incoming_webhook = SLACK_INCOMING_WEBHOOK % (domain, token)
+    slack_incoming_webhook = SLACK_INCOMING_WEBHOOK % (token)
 
     response, info = fetch_url(module, slack_incoming_webhook, data=payload)
     if info['status'] != 200:
-        obscured_incoming_webhook = SLACK_INCOMING_WEBHOOK % (domain, '[obscured]')
+        obscured_incoming_webhook = SLACK_INCOMING_WEBHOOK % ('[obscured]')
         module.fail_json(msg=" failed to send %s to %s: %s" % (payload, obscured_incoming_webhook, info['msg']))
 
 def main():
@@ -170,4 +169,4 @@
 # import module snippets
 from ansible.module_utils.basic import *
 from ansible.module_utils.urls import *
-main()
\ No newline at end of file
+main()

{"golden_diff": "diff --git a/notification/slack.py b/notification/slack.py\n--- a/notification/slack.py\n+++ b/notification/slack.py\n@@ -105,8 +105,7 @@\n \n \"\"\"\n \n-\n-SLACK_INCOMING_WEBHOOK = 'https://%s/services/hooks/incoming-webhook?token=%s'\n+SLACK_INCOMING_WEBHOOK = 'https://hooks.slack.com/services/%s'\n \n def build_payload_for_slack(module, text, channel, username, icon_url, icon_emoji, link_names, parse):\n     payload = dict(text=text)\n@@ -128,11 +127,11 @@\n     return payload\n \n def do_notify_slack(module, domain, token, payload):\n-    slack_incoming_webhook = SLACK_INCOMING_WEBHOOK % (domain, token)\n+    slack_incoming_webhook = SLACK_INCOMING_WEBHOOK % (token)\n \n     response, info = fetch_url(module, slack_incoming_webhook, data=payload)\n     if info['status'] != 200:\n-        obscured_incoming_webhook = SLACK_INCOMING_WEBHOOK % (domain, '[obscured]')\n+        obscured_incoming_webhook = SLACK_INCOMING_WEBHOOK % ('[obscured]')\n         module.fail_json(msg=\" failed to send %s to %s: %s\" % (payload, obscured_incoming_webhook, info['msg']))\n \n def main():\n@@ -170,4 +169,4 @@\n # import module snippets\n from ansible.module_utils.basic import *\n from ansible.module_utils.urls import *\n-main()\n\\ No newline at end of file\n+main()\n", "issue": "slack 404\nI'm getting the same issue as was reported here: https://github.com/ansible/ansible/issues/8669\n\nError output I'm getting is:\n\n```\nfailed: [test-domain.com -> 127.0.0.1] => {\"failed\": true}\nmsg:  failed to send payload={\"username\": \"toby\", \"text\": \"stage update has successfully completed\", \"link_names\": 1, \"channel\": \"#deploys\", \"icon_url\": \"http://www.ansible.com/favicon.ico\"} to https://pixelfusion.slack.com/services/hooks/incoming-webhook?token=[obscured]: HTTP Error 404: Not Found\n```\n\n", "before_files": [{"content": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\n# (c) 2014, Ramon de la Fuente <ramon@delafuente.nl>\n#\n# This file is part of Ansible\n#\n# Ansible is free software: you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation, either version 3 of the License, or\n# (at your option) any later version.\n#\n# Ansible is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with Ansible.  If not, see <http://www.gnu.org/licenses/>.\n\nDOCUMENTATION = \"\"\"\nmodule: slack\nshort_description: Send Slack notifications\ndescription:\n    - The M(slack) module sends notifications to U(http://slack.com) via the Incoming WebHook integration\nversion_added: 1.6\nauthor: Ramon de la Fuente <ramon@delafuente.nl>\noptions:\n  domain:\n    description:\n      - Slack (sub)domain for your environment without protocol.\n        (i.e. C(future500.slack.com))\n    required: true\n  token:\n    description:\n      - Slack integration token\n    required: true\n  msg:\n    description:\n      - Message to send.\n    required: true\n  channel:\n    description:\n      - Channel to send the message to. If absent, the message goes to the channel selected for the I(token).\n    required: false\n  username:\n    description:\n      - This is the sender of the message.\n    required: false\n    default: ansible\n  icon_url:\n    description:\n      - Url for the message sender's icon (default C(http://www.ansible.com/favicon.ico))\n    required: false\n  icon_emoji:\n    description:\n      - Emoji for the message sender. See Slack documentation for options.\n        (if I(icon_emoji) is set, I(icon_url) will not be used)\n    required: false\n  link_names:\n    description:\n      - Automatically create links for channels and usernames in I(msg).\n    required: false\n    default: 1\n    choices:\n      - 1\n      - 0\n  parse:\n    description:\n      - Setting for the message parser at Slack\n    required: false\n    choices:\n      - 'full'\n      - 'none'\n  validate_certs:\n    description:\n      - If C(no), SSL certificates will not be validated. This should only be used\n        on personally controlled sites using self-signed certificates.\n    required: false\n    default: 'yes'\n    choices:\n      - 'yes'\n      - 'no'\n\"\"\"\n\nEXAMPLES = \"\"\"\n- name: Send notification message via Slack\n  local_action:\n    module: slack\n    domain: future500.slack.com\n    token: thetokengeneratedbyslack\n    msg: \"{{ inventory_hostname }} completed\"\n\n- name: Send notification message via Slack all options\n  local_action:\n    module: slack\n    domain: future500.slack.com\n    token: thetokengeneratedbyslack\n    msg: \"{{ inventory_hostname }} completed\"\n    channel: \"#ansible\"\n    username: \"Ansible on {{ inventory_hostname }}\"\n    icon_url: \"http://www.example.com/some-image-file.png\"\n    link_names: 0\n    parse: 'none'\n\n\"\"\"\n\n\nSLACK_INCOMING_WEBHOOK = 'https://%s/services/hooks/incoming-webhook?token=%s'\n\ndef build_payload_for_slack(module, text, channel, username, icon_url, icon_emoji, link_names, parse):\n    payload = dict(text=text)\n\n    if channel is not None:\n        payload['channel'] = channel if (channel[0] == '#') else '#'+channel\n    if username is not None:\n        payload['username'] = username\n    if icon_emoji is not None:\n        payload['icon_emoji'] = icon_emoji\n    else:\n        payload['icon_url'] = icon_url\n    if link_names is not None:\n        payload['link_names'] = link_names\n    if parse is not None:\n        payload['parse'] = parse\n\n    payload=\"payload=\" + module.jsonify(payload)\n    return payload\n\ndef do_notify_slack(module, domain, token, payload):\n    slack_incoming_webhook = SLACK_INCOMING_WEBHOOK % (domain, token)\n\n    response, info = fetch_url(module, slack_incoming_webhook, data=payload)\n    if info['status'] != 200:\n        obscured_incoming_webhook = SLACK_INCOMING_WEBHOOK % (domain, '[obscured]')\n        module.fail_json(msg=\" failed to send %s to %s: %s\" % (payload, obscured_incoming_webhook, info['msg']))\n\ndef main():\n    module = AnsibleModule(\n        argument_spec = dict(\n            domain      = dict(type='str', required=True),\n            token       = dict(type='str', required=True),\n            msg         = dict(type='str', required=True),\n            channel     = dict(type='str', default=None),\n            username    = dict(type='str', default='Ansible'),\n            icon_url    = dict(type='str', default='http://www.ansible.com/favicon.ico'),\n            icon_emoji  = dict(type='str', default=None),\n            link_names  = dict(type='int', default=1, choices=[0,1]),\n            parse       = dict(type='str', default=None, choices=['none', 'full']),\n\n            validate_certs = dict(default='yes', type='bool'),\n        )\n    )\n\n    domain = module.params['domain']\n    token = module.params['token']\n    text = module.params['msg']\n    channel = module.params['channel']\n    username = module.params['username']\n    icon_url = module.params['icon_url']\n    icon_emoji = module.params['icon_emoji']\n    link_names = module.params['link_names']\n    parse = module.params['parse']\n\n    payload = build_payload_for_slack(module, text, channel, username, icon_url, icon_emoji, link_names, parse)\n    do_notify_slack(module, domain, token, payload)\n\n    module.exit_json(msg=\"OK\")\n\n# import module snippets\nfrom ansible.module_utils.basic import *\nfrom ansible.module_utils.urls import *\nmain()", "path": "notification/slack.py"}], "after_files": [{"content": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\n# (c) 2014, Ramon de la Fuente <ramon@delafuente.nl>\n#\n# This file is part of Ansible\n#\n# Ansible is free software: you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation, either version 3 of the License, or\n# (at your option) any later version.\n#\n# Ansible is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with Ansible.  If not, see <http://www.gnu.org/licenses/>.\n\nDOCUMENTATION = \"\"\"\nmodule: slack\nshort_description: Send Slack notifications\ndescription:\n    - The M(slack) module sends notifications to U(http://slack.com) via the Incoming WebHook integration\nversion_added: 1.6\nauthor: Ramon de la Fuente <ramon@delafuente.nl>\noptions:\n  domain:\n    description:\n      - Slack (sub)domain for your environment without protocol.\n        (i.e. C(future500.slack.com))\n    required: true\n  token:\n    description:\n      - Slack integration token\n    required: true\n  msg:\n    description:\n      - Message to send.\n    required: true\n  channel:\n    description:\n      - Channel to send the message to. If absent, the message goes to the channel selected for the I(token).\n    required: false\n  username:\n    description:\n      - This is the sender of the message.\n    required: false\n    default: ansible\n  icon_url:\n    description:\n      - Url for the message sender's icon (default C(http://www.ansible.com/favicon.ico))\n    required: false\n  icon_emoji:\n    description:\n      - Emoji for the message sender. See Slack documentation for options.\n        (if I(icon_emoji) is set, I(icon_url) will not be used)\n    required: false\n  link_names:\n    description:\n      - Automatically create links for channels and usernames in I(msg).\n    required: false\n    default: 1\n    choices:\n      - 1\n      - 0\n  parse:\n    description:\n      - Setting for the message parser at Slack\n    required: false\n    choices:\n      - 'full'\n      - 'none'\n  validate_certs:\n    description:\n      - If C(no), SSL certificates will not be validated. This should only be used\n        on personally controlled sites using self-signed certificates.\n    required: false\n    default: 'yes'\n    choices:\n      - 'yes'\n      - 'no'\n\"\"\"\n\nEXAMPLES = \"\"\"\n- name: Send notification message via Slack\n  local_action:\n    module: slack\n    domain: future500.slack.com\n    token: thetokengeneratedbyslack\n    msg: \"{{ inventory_hostname }} completed\"\n\n- name: Send notification message via Slack all options\n  local_action:\n    module: slack\n    domain: future500.slack.com\n    token: thetokengeneratedbyslack\n    msg: \"{{ inventory_hostname }} completed\"\n    channel: \"#ansible\"\n    username: \"Ansible on {{ inventory_hostname }}\"\n    icon_url: \"http://www.example.com/some-image-file.png\"\n    link_names: 0\n    parse: 'none'\n\n\"\"\"\n\nSLACK_INCOMING_WEBHOOK = 'https://hooks.slack.com/services/%s'\n\ndef build_payload_for_slack(module, text, channel, username, icon_url, icon_emoji, link_names, parse):\n    payload = dict(text=text)\n\n    if channel is not None:\n        payload['channel'] = channel if (channel[0] == '#') else '#'+channel\n    if username is not None:\n        payload['username'] = username\n    if icon_emoji is not None:\n        payload['icon_emoji'] = icon_emoji\n    else:\n        payload['icon_url'] = icon_url\n    if link_names is not None:\n        payload['link_names'] = link_names\n    if parse is not None:\n        payload['parse'] = parse\n\n    payload=\"payload=\" + module.jsonify(payload)\n    return payload\n\ndef do_notify_slack(module, domain, token, payload):\n    slack_incoming_webhook = SLACK_INCOMING_WEBHOOK % (token)\n\n    response, info = fetch_url(module, slack_incoming_webhook, data=payload)\n    if info['status'] != 200:\n        obscured_incoming_webhook = SLACK_INCOMING_WEBHOOK % ('[obscured]')\n        module.fail_json(msg=\" failed to send %s to %s: %s\" % (payload, obscured_incoming_webhook, info['msg']))\n\ndef main():\n    module = AnsibleModule(\n        argument_spec = dict(\n            domain      = dict(type='str', required=True),\n            token       = dict(type='str', required=True),\n            msg         = dict(type='str', required=True),\n            channel     = dict(type='str', default=None),\n            username    = dict(type='str', default='Ansible'),\n            icon_url    = dict(type='str', default='http://www.ansible.com/favicon.ico'),\n            icon_emoji  = dict(type='str', default=None),\n            link_names  = dict(type='int', default=1, choices=[0,1]),\n            parse       = dict(type='str', default=None, choices=['none', 'full']),\n\n            validate_certs = dict(default='yes', type='bool'),\n        )\n    )\n\n    domain = module.params['domain']\n    token = module.params['token']\n    text = module.params['msg']\n    channel = module.params['channel']\n    username = module.params['username']\n    icon_url = module.params['icon_url']\n    icon_emoji = module.params['icon_emoji']\n    link_names = module.params['link_names']\n    parse = module.params['parse']\n\n    payload = build_payload_for_slack(module, text, channel, username, icon_url, icon_emoji, link_names, parse)\n    do_notify_slack(module, domain, token, payload)\n\n    module.exit_json(msg=\"OK\")\n\n# import module snippets\nfrom ansible.module_utils.basic import *\nfrom ansible.module_utils.urls import *\nmain()\n", "path": "notification/slack.py"}]}