Hi, I finally setup push notifications but I’m struggling to get a message with timestamp to work. I mean if I try to launch the service notify.my_notifier with the following JSON string:
{“message”:“This is a test to say what time it is :”, “data”: {
“timestamp”:“now()”
}
}
It is showing my message but without displaying the time. I want to format it using:
{“message”:“This is a test to say what time it is :”, “data”: {
“timestamp”:“now().strftime(’%H:%M’)”
}
}
But as my first JSON does not work properly this one doesn’t work either. Could you please help me to find where my error is? I guess It’s a syntax problem but I don’t get it.
…And it seems that all data info added is not supported by html5 and will be sent back to you in the callback events. So does this mean that we cannot notify and display the exact hh:mm when our notification was triggered?? There should be some way to be able to do that. Thanks!!
OK, now I’m back, sorry again for my delay answering. As I see it yours is the same case as mine, you just have to embed the JSON tempalte inside your message. Look at an extract of one of my scripts:
- data:
message: '{{ as_timestamp(now()) | timestamp_custom(''%H:%M'', true) }} - Covers are
going to be closed.'
service: notify.my_notifier
or in your example, just change: message: ‘Open’ for:
data:
title: ‘GATE’
message: ‘{{ as_timestamp(now()) | timestamp_custom(’’%H:%M’’, true) }} - Open’
Yes, indeed, timestamp field is not working for html5 push notifications. However you can use this method inside the message tag as a nice workaround and you can format date and time as you wish as described in this link: