Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix payload to match Rocket Chat 7.4.1 API #9882

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
6 changes: 4 additions & 2 deletions plugins/modules/rocketchat.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def build_payload_for_rocketchat(module, text, channel, username, icon_url, icon
attachment['fallback'] = attachment['text']
payload['attachments'].append(attachment)

payload = "payload=" + module.jsonify(payload)
payload = module.jsonify(payload)
return payload


Expand All @@ -208,7 +208,9 @@ def do_notify_rocketchat(module, domain, token, protocol, payload):

response, info = fetch_url(module, rocketchat_incoming_webhook, data=payload)
if info['status'] != 200:
module.fail_json(msg="failed to send message, return status=%s" % str(info['status']))
response, info = fetch_url(module, rocketchat_incoming_webhook, data="payload=" + payload)
if info['status'] != 200:
module.fail_json(msg="failed to send message, return status=%s" % str(info['status']))


def main():
Expand Down