Example: Social Activities

Sending notifications based on "Likes", "Follows", "Invites" or "Comments"

For social sites or apps that send notifications to involved users when some type of social activity occurs.

User Followed You: “John234 just followed you!”
User following Posted: “John234 just posted ‘How I became a pro gamer’ on AwesomeApp”
User Messaged You: “Melissa Grant says ’HI DUDE! Where are ya!’”
Request for Response to Invite: “Let Julia know if you can make it to Board Games Night”
User-User Thread Reply: “Melissa Grant says ’lol really?’”
VOIP Call: “Call from: Mom”
User Replied to Thread You’re In: “Melissa Grant replied ‘What do you guys think? Pizza?’”
User @Mentioned You: “Josh mentioned you in a tweet ‘Notifications rule! cc:@george’”
User Liked/Retweeted your content: “Gerry Cardinal liked your tweet ’KD is going to the dubs!’”
User Tagged You: “Long Vo tagged you in a photo”
User Replied to Your Content: “@george but don’t you think that’s wrong because reasons?”
User Shared Content With You: “Mom shared the album ‘Hawaii’ with you”
User Invited You to Something: “George invited you to the SAO guild ‘Laughing Coffins’”


  • CRM or Database


Step 1. Map Your Users

Upon setting up OneSignal in your app, you should be creating Aliases & External ID to map your users from your database to OneSignal.

Step 2. Detect The Activity or Event

When the user performs the social action you need to capture the event, the User ID that performed the action and the User ID that received the action. Generally this will be saved to a database of events.

OneSignal does provide the option to Add Data Tags to devices, but this is limited and should be used sparingly to collect either "total likes", "total follows", etc. You can also use tags for Message Personalization which will show the current user's name that receives the push. For example, you can send a message "Hi Jon, you have 10 followers." by tagging each user with their "name" and incrementing their followers count.

Step 3. Send The Message

Now that you have the User IDs and actions, you can send a notification with the API by targeting your unique User IDs with the include_aliases: { "external_id": [...] } parameter or other alias.


User A gets "Liked" by User B.

When User B performs the "Like", your CRM or Database detects this and you have User A's unique User ID.

You can use the API to send a notification to User.

curl --include \
     --request POST \
     --header "Content-Type: application/json; charset=utf-8" \
     --header "Authorization: Basic YOUR_REST_API_KEY" \
     --data-binary "{\"app_id\": \"YOUR_APP_ID\",
\"contents\": {\"en\": \"You got a new Like!\"},
\"include_aliases\": {\"external_id\": [\"YOUR_USER_ID\"]}}" \

Comments or Group Involvement

User A has created a post that User B, C and D has commented on.

You would associate User A's external_id to that post as the "author" or "creator".

When User B makes a comment, you can now save User B's ID as a "commenter" to the post and trigger a push to User A. You can save the comment as the message "contents" and have the title as "New Activity" or "New Comment: Post Title".

When User C, D or A also comments or replies, you can then save the new User IDs to the "commenters" array and target all IDs when new updates are made.

Extra add-ons

Personalize the messages

You can then add personalizations to the notification using Message Personalization )

When User A gets the new social Activity, you can tag User A with User B's name.

Activity Feed

You can track notification data within your app by creating an Activity Feed