Rest notify example

Hi folks,

I’m trying to figure out how to use the REST notify platform and am looking for an example of how to use it and call it. Does anyone know if there is a fully flushed out example somewhere online?

I’m trying to send messages to my zulip server. Their documentation says to do this:

curl https://zulip.example.com/api/v1/messages \
    -u BOT_EMAIL_ADDRESS:BOT_API_KEY \
    -d "type=stream" \
    -d "to=Denmark" \
    -d "subject=Castle" \
    -d "content=Something is rotten in the state of Denmark."

Setting up the above is simple and it is very easy to send messages to zulip with curl… I’m just not certain how to configure HA to send the information…

I put this in my configuration.yaml

notify:
  - name: zulip 
    platform: rest
    resource: https://zulip.example.com/api/v1/messages
    title_param_name: 'subject'
    target_param_name: 'stream'

So… how can I call it to notify me if someone is not_home or home. Ie send a message if someone leaves or enters a zone. I’m not sure how to pass the information to the notifier… :frowning:

Any suggestions on how folks think the best way to achieve this? Perhaps scripting it out would be better?

1 Like

Hi @GervaisdeM

Sorry, I know this has been a while back. But I am curious if you got this sorted out in the end. I was looking for Rest notify examples and found your post.

Or if anyone else has an example to share, that will be much appreciated!

Thanks!

Hi @julianchua

I did figure it out in the end.

configuration.yaml

automation.yaml

secrets.yaml

zulip_notify_resource: 'https://zulip.example.com/api/v1/external/homeassistant?api_key=myAPIkey&stream=MyStream'

This is where I got the end point I needed for my secrets.yaml

3 Likes

Thanks @GervaisdeM!

That’s helpful.