I am using a bash script with curl that does something similar:
local/share/check_mk/notifications/my-custom-notify.sh
#!/bin/bash
# Custom Notify by JSON HTTP
# In the second line after the comment character # is a Title for the script.
# As a rule this will be shown when selecting the notification method.
....
timeout 5 curl \
--silent \
--request POST \
--header 'Content-type: application/json' \
--data '{"text":'"'$msg'"'}' \
--connect-timeout 3 \
"${hook_url}"