[SOLVED] - Make snips say something

Hi all , i’m trying to get my head around making snips say something via the MQTT node in node red.

I’m trying to make sense of this page https://docs.snips.ai/reference/dialogue but until i know what i’m doing its just confusing me.

Is someone able to please show me the command you would use to publish a mqtt message to snips to say the words hello world or something ?

I tried

mosquitto_pub -h snips.local -t 'hermes/tts/say' -m '{"text": "Bonjour!"}'
but i was really only copying and pasting from the snips website without knowing what i was doing anyway so didn’t surprise me that it didnt work :slight_smile:

Hi lazza,

just a guess, how about adding the Location, where to play it, just like:
% mosquitto_pub -h snips.local -t ‘hermes/tts/say’ -m ‘{“siteId”:“default”,“text”:“Bonjour”}’

And in my opinion you can also leave that -h snips.local away, you are most likely anyway on the host running the mqtt broker. For me it works like that and as said i leave the -h option away.

Does this work?

don’t use tts/say that is an internal snips method

use the notification https://docs.snips.ai/reference/dialogue#session-initialization-notification

Thanks ozzie. I’ll try that when I’m home tomorrow. Is it the same pub command as above but replacing the tts section with what’s on that page you pointed to ?

not exactly https://docs.snips.ai/reference/dialogue#payload-1

in the init:{type, text }

the type will be notification as opposed to action

hi ozie, not sure i have syntax correct or something ? are you able to give me a example of what should work thanks ?

As mentioned i’m still trying to get my head around it all but what i tried was

mosquitto_pub -t hermes/dialogueManager/startSession -m “init”:{“type”:“notification”,“text”:“hello world”}"

but that doesnt work so assuming i don’t have something quite right

Oh Oh Oh … for those playing along :slight_smile:

I worked it out.

To publish a MQTT message to snips to make it say something to you use the following command line

 mosquitto_pub -t hermes/dialogueManager/startSession -m '{"init":{"type":"notification","text":"hello world"}}'

Thanks to those that pointed me in the right direction

Because i’m new to this and learning as i go i think it’s only fair i leave a trail of steps for any other new snips/ raspberry / home automation /node red noob like me :slight_smile: so we can all learn.

If you are wanting to get snips to respond with a notification via node red when something happens in node red such as… say “welcome home” when Home assistant senses you’ve just arrived home. Then you can achieve that by doing the following

In node red you need to use a “MQTT output” node. and suggest a “change node”. The MQTT output node needs to be set up to your MQTT broker that runs snips. and the topic you publish to is


as per this screen shot


Then add a "change node " and set the payload to what ever text you want spoken, for this example we are asking snips to say “hello world”

{“init”:{“type”:“notification”,“text”:“hello world”}}

NOTE: because we are using this inside a change node we don’t need the proceeding and trailing ’ ’ (before and after the curly brackets) like we would if sending the publish command directly at a command prompt like in a raspberry pi.

now you connect the right hand side of the change node to the MQTT publish node and the left hand side of the change node to the end of your Node red flow.
In this below example i have it just connected to a “inject node” for testing however if we had a flow that detected when your home then you would connect the change node to the end of that flow so that once it triggered, this MQTT node would publish a topic to snips and make her/him speak.


Hope that helps other tinker’ers out there that want Snips to talk to you via node red