Social Activity
Learn how to use OneSignal to send push notifications for social actions like likes, follows, and invites, as well as for user-to-user direct messages.
Use OneSignal to notify users about social activity (likes, follows, invites) and user messages. These alerts can drive re-engagement even when users aren’t currently active in your app.
OneSignal and push notifications are not designed explicitly for real-time communication. They are best used as a fallback when both users are not active on your app.
For real-time communication, consider dedicated live chat solutions such as:
Social activity notifications
Trigger a push notification when a user is involved in social actions.
Common social actions
Action | Example message |
---|---|
Like | “Anna liked your post.” |
Mention | “Leo mentioned you in a comment.” |
Tag | “Sara tagged you in a photo.” |
Invite | “Ben invited you to the event.” |
Comment | “Maya replied: ‘Looks awesome!’” |
Follow | “James started following you.” |
Share | “Alex shared ‘Hawaii Album’ with you.” |
Requirements
- A backend or CRM that tracks user activity and relationships.
- External IDs set in OneSignal to identify users.
- Using our Create Notification API.
Setup
1. Map users with External ID
Use Aliases & External ID to uniquely identify users in OneSignal.
2. Detect the social action
In your backend, track who performed the action and who it affects.
3. Send a push notification
Use the OneSignal API to notify the recipient:
Add-ons
- Use Message Personalization to insert custom data like usernames, post titles, images, and more!
- Display a history of social alerts using an Activity Feed.
Direct (user-to-user) messages
Let users know they have a new message and optionally include message content or a deep link to the chat.
Setup
1. Map users with External ID
Use Aliases & External ID to uniquely identify users in OneSignal.
2. Trigger a notification on message send
From your backend, send a push to the recipient using the Create Notification API with the include_aliases
field:
Best practices
- Avoid spamming: Don’t send a notification for every single message. Use batching or only alert after X minutes of inactivity.
- Respect user settings: Let users mute or disable message notifications if needed.
- Use routing logic in your app to open the conversation. See Deep Linking for more information.