Created
June 25, 2018 12:41
-
-
Save funkyboy/40b7c253fc0f6bf2660d268a3a29f2a4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from ably import AblyRest | |
client = AblyRest('YOUR_KEY') | |
channel = client.channels.get('push:test') | |
item_type = u'this is item type' | |
event = u'this is event' | |
extras = { | |
'push': { | |
'notification': { | |
'title': 'Hello', | |
'body': 'Hello body', | |
'sound': 'Fresh_Notify.wav', | |
'collapseKey': u'oculd-{}-{}'.format(item_type, event) | |
}, | |
'data': { | |
'item_type': item_type, | |
'event': event | |
}, | |
'apns': { | |
'aps': { | |
'alert': { | |
'title-loc-key': u'{}-{}-NOTIFICATION-TITLE'.format(item_type, event).upper(), | |
'loc-key': u'{}-{}-NOTIFICATION-MESSAGE'.format(item_type, event).upper() | |
} | |
} | |
} | |
} | |
} | |
channel.publish(name='this is name', data='this is data', extras=extras) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment