Webhook and SSO user mapping

AI-generated summary

Vaishak_Kallore discusses integrating a Discourse forum with a mobile app using webhooks for push notifications. They aim to prevent sending notifications to the user who posted or replied, but the webhook lacks user email or SSO external ID. Vaishak_Kallore proposes a workaround: using a user event webhook to store user email and forum ID, then using this data to filter notifications in the mobile app. They suggest sending FCM/GCM IDs in the payload or filtering eligible users, but note the latter is not scalable. They seek better solutions for user mapping in webhooks.

Hi there,

I have successfully setup my first Discourse forum having force SSO login.

I would like to have this forum integrated in mobile app as well, for better impressions and was looking for Cloud Messaging options around. As Discourse has only push notifications, I have figured out the webhook way, which will send notifications to my external server, which will handle GCM/FCM calls.

It was successful with the integration, but I would like to prevent sending notifications to the same user who had posted/replied. I can identify the user if email address or SSO external ID is passing along with webhook requests (username trim from @!).

Can someone provide a solution to get posted user’s email/SSO external ID in webhook?

Thanks in advance.

I have a solution here, not straight forward, but I feel it should work.

Step 1

  1. Create another webhook which will be triggered on User Event
  2. Disable email editable option for users
  3. When the webhook triggers, take user email address and update user’s forum ID in user database.

Step 2

  1. When user login in the mobile application, get user’s FCM/GCM ID
  2. Update FCM/GCM ID user database
  3. When topic/post event trigerrs
    a) Send to all users through topics subscription, mention user’s FCM/GCM ID in data payload and skip showing the notification to that user
    OR
    b) Get users who are eligible to get notifications (having mobile app) except the one who has posted/replied and send to others (This is not a scalable solution, I suppose)

Any other suggestions or straight forward methods/approach available?