URL Notification Link

ios
Tags: #<Tag:0x00007f204315f5f8>

#1

I am trying to send a URL link to my phone through the HA app. When I use the following in the services developer tool, it works as expected:

{
	"title": "Test URL",
	"message": "waze://?favorite=work"
}

I would prefer it to not show the full website address, so I tried changing to:

{
	"title": "Test URL",
	"message": "Navigate",
	"data": {
		"url": "waze://?favorite=work"
	}
}

I have also tried:

{
	"title": "Test URL",
	"message": "Navigate",
	"data": {
		"attachment": {
			"url": "waze://?favorite=work",
		}
	}
}

When I do that, I get the notification, but I am not able to click on the text to go to the URL. Does anyone know if this is possible?


#2

Great feature request, will be out in the next version :slight_smile:

EDIT: BTW, the reason it’s not working is because attachment is expected to be an image, audio or video file. You will need to tweak the format slightly to open URLs.


#3

Awesome! Love the app you have built and glad to see you keep improving it. Figured it was looking for some type of file association with the attachment, but wanted to try all the possible combinations before posting.

Looking forward to the next release!


#4

This has been included in the forthcoming 1.1.1 which I just submitted to Apple. It should be released tomorrow. Thanks for the feature request!


#5

Perfect! Thanks for getting it implemented so fast.


#6

has this been implemented yet? i still cannot get this to work…


#7

Yes, it is working for me. How do you have the notification setup? Below is my notification to open waze and start navigating if there is heavy traffic.

action:
  service: notify.ios_michael_iphone
  data:
    title: "Work Detour"
    message: "Navigate using detour?"
    data:
      url: waze://?favorite=work

Launching a URL using actionable notifications, is it possible?
#8

Just curious in the trigger for that automation @shire210


#9

The trigger is set to send the notification if I leave my house between 6:30-7:00 on a weekday if “alternate route” is turned on. For the alternate route sensor, I have a google travel time sensor set up and compare the distance listed in that sensor to the usual commute distance. If those two numbers are different, it turns “alternate route” ON.

trigger:
  platform: state
  entity_id: input_boolean.ios_home
  to: 'off'
condition:
  condition: and
  conditions:
    - condition: time
      after: '06:30:00'
      before: '07:00:00'
      weekday:
        - mon
        - tue
        - wed
        - thu
    - condition: state
      entity_id: binary_sensor.alternate_route
      state: 'on'
action:
  service: notify.ios_michael_iphone
  data:
    title: "Work Detour"
    message: "Navigate using detour?"
    data:
      url: waze://?favorite=work

#10

i wrote it as:
action:
service: notify.ios_phone
data:
title: ‘New Version of Home Assistant Available!’
message: ‘Check the release notes here.’
data:
attachment:
url: https://www.home-assistant.io/blog/


#11

well i’m not sure why that didn’t copy correctly…

action:
  service: notify.ios_scotts_iphone
  data:
    title: 'New Version of Home Assistant Available!'
    message: 'Check the release notes here.'
    data:
      attachment:
        url: https://www.home-assistant.io/blog/

#12

Do regular notifications work (ones without links)? I would try removing the “attachment” portion and using double quotes.

action:
  service: notify.ios_scotts_iphone
  data:
    title: "New Version of Home Assistant Available!"
    message: "Check the release notes here."
    data:
      url: https://www.home-assistant.io/blog/

I just tested it by going to the “Services” section under developer tools. Under “Service” select notify.ios_scotts_iphone and under service data, I used the following:

{"title":"'New Version of Home Assistant Available!'","message":"Check the release notes here.","data":{"url":"https://www.home-assistant.io/blog/"}}

#13

ok. i got that working… is there any way to do that with an actionable notification? so i have set up options for ‘update’, ‘read release notes’, ‘stop reminding me’, and ‘remind me later’. i would like it to just open the release notes when i click that option, but instead from what i can tell it would just have to send another notification to do so


Notification Actions on Local Device?
#14

I believe you are correct. I am not aware of any way to do that without having it send a new notification.


#15

Is this still working for you? I am trying to set up the exact same automation but can’t get the URL to pass either using Google, Waze or Apple maps. The notification just ignores it.


#16

Yes, it is still working perfectly for me. Not sure why it wouldn’t be working for you. If you can post your code, I can take a look at it and see if everything was set up correctly there. If you are getting the notification on your phone, you can just paste the “Action” piece.


#17

Here’s the code in question. I’ve not gotten as far as building out the automation with triggers/conditions (at present I’ve just set it to go at a time of day, and am triggering it via automation.trigger to test it). I’ve commented out the other services I’ve tried to implement, none of these are working. iOS simply shows the title/message and no map.

I’ve tried using data: attachment: and that has no change.

action:
  - service: notify.ios_matt
    data:
      title: 'Commute Update'
      message: 'Here's an update for you...'
      data:
        #url: waze://?favorite=work
        url: http://maps.apple.com/?saddr=Cupertino&daddr=San+Francisco
        #url: 'comgooglemaps://?saddr=Cupertino&daddr=San+Francisco&directionsmode=driving'

#18

Okay. I pasted that into an automation and it worked perfectly. What happens when you click on the notification? Does it take you into the Home Assistant app or does it do nothing at all?


#19

Ahhh ok - I’d not followed it through HA previously as I’d assumed it would direct me straight to Waze/Google/Apple etc. I can click the notification and it takes me into HA and then I can click again for directions. Problem solved - the error was the user!


#20

Glad you got it sorted out. If you click on the settings button (Gear in bottom right) in the HA app, scroll down to “Notification Settings”, you can turn off “Confirm before opening URL”. If you do that, when you click on the notification, it will open HA and then switch right over to the correct app. It skips you having to click again to get the directions.