Service Notify Mobile Actions: What is the data structure? #602
-
Im trying to write a script to send Push Notifications to mobile but I can figure out the data structure required for actions within the push notification. So the yaml specs look like this
and I have tried stuff like this but I cant seem to get it to work.
If anyone knows what the structure is I need that would be much appreciated thankyou. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
your first variant is right, but you messed up the syntax. my advice is to use dictionaries with keywords instead of strings {'key': 'value', 'key2': 'value2'}
dict(key='value', key2='value2') but the second variant is more easily readable and comes with less typos def mobile_XXXXXXX(message: str, title: str = '', target=None, data=None): so your answer is (with my advice in mind) notify.mobile_XXXXXXXX(
message="actiontest",
data=dict(
actions=[
dict(action="Test", title="sometitle")
]
)
) or without the spacing notify.mobile_XXXXXXXX(message="actiontest", data=dict(actions=[dict(action="Test", title="sometitle")])) https://github.com/dmamelin/pyscript_autocomplete helps with autocompletion and method signatures. |
Beta Was this translation helpful? Give feedback.
your first variant is right, but you messed up the syntax. my advice is to use dictionaries with keywords instead of strings
in Python these are equal
but the second variant is more easily readable and comes with less typos
the signature of notify.x method is
so your answer is (with my advice in mind)
or without the spacing