Help with command_line notification service

I am trying to create a command_line notification service to call a webhook via curl. I have it working by testing it straight on the Hass OS terminal, but it’s not working by calling the service. Here is my configuration.yaml:

notify:
  - platform: command_line
    name: clinotify
    command: 'read msg && curl "http://<url>" --data-urlencode "msg=${msg}"'

I have also tried:
'bash -c "read msg && curl \"http://<url>\" --data-urlencode \"msg=${msg}\"'

I’m probably handling the stdin wrong, but it worked fine in the terminal, so idk
Thanks for any help