Example: User-User Messages
How to use OneSignal for user-to-user messages.
Push Notifications are Not designed for live chat.
Push Notifications are best used as a fallback when both users are not active on your app.
Tools dedicated to Live Chat functionality include:
If your app uses private or direct messaging and you want to display a push notification alerting a user that a message was sent to them you may want to consider using one of the above technologies. OneSignal is best used for marketing or Transactional Messages from your company to user.
That being said, it is possible to setup User-to-User Push Notifications through OneSignal following these steps.
1. Set the External User ID
You should use OneSignal's External User Ids to match your database User Id with the device records in OneSignal. See Database, DMP, & CRM Integration for more details.
Another option is save the OneSignal Player Id which is the OneSignal device-record user id to your database.
Both options can be used target devices individually with push notifications.
2. Send the Message
After users and devices are matched between your database and OneSignal, you can send a push notification to the user receiving the message so they click the push, open your app, and see the message.
To send a Push Notification to a user, call our API Create notification method using the
include_external_user_ids property if targeting External User Id or
include_player_ids property if targeting OneSignal Player Ids.
Alternatively, each of our mobile SDKs has a
postNotification method that can target users by player_id using the
include_player_ids parameter only. If you set the External User ID, you should trigger requests from your server.
Updated 5 months ago
Create an activity feed to show the notifications sent within your mobile app