Random sentences with voice monkey?

I use TTS on speakers when my wife comes home, for example. This outputs random sentences from a selection. Actually, I want to use Alexa for this, but the integration is not as reliable as I would like it to be and has to be reconfigured more often (hence separate speakers).

configuration.yaml:

service: tts.cloud_say
data:
  message: >
    '{{ ["Hello, have you gained weight?", "Welcome back!", "Hey, glad you're here!", "What are you doing here again?", "I guess that's the wife that's back.", "wife's here, the silence is over.", "Yoo-hoo, she's back. I'm so happy!"] | random }}'
  entity_id: >-
    media_player.nest_hub_livingroom,media_player.speaker_bathroom,media_player.lautsprecher_kitchen

Now, however, I have discovered Voice Monkey, with which I can very reliably announce sentences via Alexa. But unfortunately only one predefined in each case.

configuration.yaml:

trigger_monkey_monkeyechodobathroomrain:
    url: https://api.voicemonkey.io/trigger 
    method: POST
    verify_ssl: true
    content_type:  'application/json; charset=utf-8'
    payload: !secret monkeyechodotbathroomrain

secrets.yaml:

monkeyechodotbathroomrain: '{"access_token":"xxxxxx","secret_token":"xxxxxx","monkey":"monkeyechodotbathroom","announcement":"It's raining"}'

Is there a way to get Home Assistant to output a random phrase from Voice Monkey in this case as well?

And you are still alive?

Of course :laughing:

Try something like…

mysecret: >
  {{ '{"prop": "%s"}' % (["value1", "value2", "value3"] | random) }}

Or

mysecret:
  prop: '{{ ["value1", "value2", "value3"] | random }}'

I haven’t tested any of them
Just let us know.

Thanks for the idea!
Seems not to work.

Variant 1:
Error loading /config/configuration.yaml: while scanning a block scalar
in “/config/secrets.yaml”, line 17, column 36
expected a comment or a line break, but found ‘{’
in “/config/secrets.yaml”, line 17, column 38

Variant 2:
Error loading /config/configuration.yaml: mapping values are not allowed here
in “/config/secrets.yaml”, line 17, column 40

Last try…

trigger_monkey_monkeyechodobathroomrain:
    url: https://api.voicemonkey.io/trigger 
    method: POST
    verify_ssl: true
    content_type:  'application/json; charset=utf-8'
    payload:
      access_token: !secret monkeyechodotbathroomrain_access_token
      secret_token: !secret monkeyechodotbathroomrain_secret_token
      monkey: monkeyechodotbathroom
      announcement: '{{ ["value1", "value2", "value3"] | random }}'

That was one of my first ideas.
With it you get:

Invalid config for [rest_command]: template value should be a string for dictionary value @ data[‘rest_command’] (…)

Well, not solvable at the moment.