Scraping a URL with a dynamic argument

I have a TTS engine that I currently call from HA via a series of shell_command’s that I’ve put together. A separate shell_command for each thing I might want to say. Is there a way to make part of my URL a variable so that I can pass arbitrary text to one script and have it handle my TTS rather than creating a bunch of shell_commands?

I know that shell_commands can handle templating, but I don’t see a way to send them variables.

Also - Is there a better way to tap a URL than using cURL from the shell?

I guess, what I’m looking for - unless there’s a better way to tap a URL is something like:

shell_command:
  testvar: bash /home/pi/scripts/speak.sh {{ texttospeak | urlencode }}
script:
  speaktest:
    alias: "Pass text to a shell command"
    sequence:
      - service: shell_command.testvar
        data:
          variables:
            texttospeak: 'This is only a test'