Skip to content

Instantly share code, notes, and snippets.

@funkyboy
Created June 25, 2018 12:41
Show Gist options
  • Save funkyboy/40b7c253fc0f6bf2660d268a3a29f2a4 to your computer and use it in GitHub Desktop.
Save funkyboy/40b7c253fc0f6bf2660d268a3a29f2a4 to your computer and use it in GitHub Desktop.
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