Notifications for a social app

Maya bakes bread in Portland and shares photos of it on a social app. Her Saturday post of a sourdough loaf picks up twelve likes before lunch, plus three comments and two follows. Your backend sends us an event for each one. A recipe then picks who gets told, and how soon. Twelve likes on her post arrive as one line, and a chat she is reading right now stays quiet on her phone.

Set up once

  1. Create the app and finish the setup for each platform you ship: web, Android, iPhone.
  2. Link every device after sign-in, and unlink it on sign-out.
  3. Turn on the social recipes, in the console under Push, Journeys, or with one call each.
  4. Add a webhook for notification.opened if the product's own analytics should see which notifications bring people back. The server page shows how to verify it.

Triggers

When this happensYour server sendsWhat the person gets
Someone follows Mayauser.followed with user_id:"maya", actor_id, actor_namenew_follower: Jordan and 4 others started following you
Someone likes her postpost.liked with post_id, post_title, post_urllikes: one notification per post that updates, Sam and 11 others liked your post
Someone comments on itpost.commented with comment_id and textcomments: grouped per post, the latest comment as the text
Someone replies to her commentcomment.repliedreplies: grouped per comment
Someone mentions heruser.mentioned with context_id and textmentions: sent at once, threaded per conversation
Someone shares her postpost.sharedshares: grouped per post
A direct message arrivesmessage.received with conversation_id and previewdirect_messages: one notification per conversation, held back while she is in the app
She opens the appsession.startedre_engagement waits for a quiet week, with marketing consent

Every event is a POST /events with the person who should hear about it in user_id, as the product's own user id. The event schema has the properties for each.

POST https://api.bolrach.com/push/v1/events
{ "app_id": "YOUR_APP_ID", "name": "post.liked", "user_id": "maya", "idempotency_key": "like-p91-by-sam",
  "properties": { "actor_id": "sam", "actor_name": "Sam", "post_id": "p-91",
                  "post_title": "Saturday farmers market", "post_url": "https://social.example.com/p/91" } }

When the idempotency_key comes from the product's own ids, a double tap or a retried job counts once.

Turn the recipes on

POST https://api.bolrach.com/push/v1/apps/YOUR_APP_ID/recipes/likes:enable
POST https://api.bolrach.com/push/v1/apps/YOUR_APP_ID/recipes/new_follower:enable
POST https://api.bolrach.com/push/v1/apps/YOUR_APP_ID/recipes/comments:enable
POST https://api.bolrach.com/push/v1/apps/YOUR_APP_ID/recipes/direct_messages:enable

Each call publishes a journey with sensible defaults. For an audience that would rather get one evening summary, turn on activity_digest in place of the three instant recipes. It collects the day's likes, comments and follows into a single push.

Let people choose

Each social recipe tags its sends with a category, such as social_likes for likes and social_messages for chats; the journeys guide has all five. Put them in the preference centre and Maya can keep message alerts while switching off likes. One post, conversation or person is muted with PUT /apps/{id}/users/{user}/mutes/{key}, and the unread count for an in-app bell comes from GET /apps/{id}/users/{user}/badge.

Machine-readable: openapi.json. Console: bolrach.com/push.