Auto generation of user api keys for push notification

We are currently working on integrating our discourse forum into our mobile app. I have gone through several topics about whitelisting discourse mobile apps and push notifications.

I understand at this point that users have to Authorize discourse to push notifications by issuing a user api key with a push_url (as query params) which specifies my custom push notification server.

Since the discourse forum will be integrated in our own app (we are using webview and SSO to show the user our forum), we don’t want users to have to Authorize discourse our own app, especially since they have already logged into our app.
We are trying to automate the generation of this user api key (with the push_url) for all users so that we can allow the users to manage the notification permissions in our app.

So my question is: Can I somehow generate user_api_keys with the push_url for each user who logs in without them having to click on the Authorize button?

This has push notifications already integrated into it

That would require a plugin and direct db access

I see. Thanks a lot for your help @sam. I ended up installing the Discourse Webhooks plugin which allows me to trigger a webhook on any internal event. I trigger the webhook on the internal notification event and then handle the notifications on my server since I already have permission to push to the end user’s device.

Thanks again!

1 Like