Skip to content

Commit b6f9a6d

Browse files
committed
Update README
1 parent 60b260d commit b6f9a6d

File tree

1 file changed

+43
-5
lines changed

1 file changed

+43
-5
lines changed

README.rst

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,54 @@ Use your instance id and secret (you can get these from the
3737
secret_key='YOUR_SECRET_KEY_HERE',
3838
)
3939
40-
Publishing a Notification
41-
~~~~~~~~~~~~~~~~~~~~~~~~~
40+
Publishing to Device Interests
41+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4242

43-
Once you have created your Beams PushNotifications instance you can publish a push notification to your registered & subscribed devices:
43+
You can broadcast notifications to groups of subscribed devices using `Device Interests <https://docs.pusher.com/beams/interests>`__:
4444

4545
.. code::
4646
47-
response = pn_client.publish(
47+
response = pn_client.publish_to_interests(
4848
interests=['hello'],
49-
publish_body={'apns': {'aps': {'alert': 'Hello!'}}, 'fcm': {'notification': {'title': 'Hello', 'body': 'Hello, World!'}}}
49+
publish_body={
50+
'apns': {
51+
'aps': {
52+
'alert': 'Hello!'
53+
}
54+
},
55+
'fcm': {
56+
'notification': {
57+
'title': 'Hello',
58+
'body': 'Hello, World!'
59+
}
60+
}
61+
}
62+
)
63+
64+
print(response['publishId'])
65+
66+
Publishing to Authenticated Users
67+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
68+
69+
Securely send notifications to individual users of your application using `Authenticated Users <https://docs.pusher.com/beams/users>`__:
70+
71+
.. code::
72+
73+
response = pn_client.publish_to_users(
74+
user_ids=['user-0001'],
75+
publish_body={
76+
'apns': {
77+
'aps': {
78+
'alert': 'Hello!'
79+
}
80+
},
81+
'fcm': {
82+
'notification': {
83+
'title': 'Hello',
84+
'body': 'Hello, World!'
85+
}
86+
}
87+
}
5088
)
5189
5290
print(response['publishId'])

0 commit comments

Comments
 (0)