Notification gateway api

I want to create my own notifications gateway. Looks like code of gateway is not published. Is there any docs on api of gateway? Cant find any

Hi! Welcome back to our forums :slight_smile:

Here you have a discussion on this subject:

and here some docs on how to compile your own mobile app for that:
https://docs.rocket.chat/guides/mobile-guides/push-notifications#self-configured

I already saw it. I wanna build my own mobile app that can work with multiple servers,
so i cant use direct notification sender built in server and i cant use rocketchat gateway.
I need to create my own gateway but i dont know how to do that because
source code of gateway is not opensourced and api is not documented.

One thing you can to is define the gateway api in Rocket.Chat to your own app, and from there relay those payloads for your own gateways.

Also, you are welcome to join our dev channels, where other developers with more knowledge on this may be able to help you better then I can :slight_smile:

I dont want to change server code, just want to create gateway that fits current api.

I mean changing in Admin > Push > Gateway.

So instead of sending to our gateway, it will send to yours gateway (a custom one you will need to build), you then relay it to the Notification Services with the corresponding keys built into your whitelabel mobile app.

Again, I am not an expert on Notifications, so not sure this is a possible or best approach for that.

As @dudanogueira mentioned, you will have to build your own and work with what Rocket.Chat sends. If you are looking for a step-by-step guide on how to do that, we do not have that since we encourage our users to use our gateway. You will have to do R&D yourself by inspecting the payloads, figuring out how to integrate with Apple and Google and then getting the push notifications to apps. The last part has already been linked, so that’s a huge chunk of R&D out of the way already.

1 Like

i am trying to inspect payload but this is what happened

{"level":40,"time":"2023-08-21T10:38:33.284Z","pid":25013,"hostname":"chat","name":"Push","msg":"Error sending push to gateway (not authorized) '{\"detail\":\"Given token not valid for any token type\",\"code\":\"token_not_valid\",\"messages\":[{\"token_class\":\"AccessToken\",\"token_type\":\"access\",\"message\":\"Token is invalid or expired\"}]}'"} 

Did you find a way to create your own gateway

i think it need soome access token in return but not sure what it actually wants. currently when i want to print the payload of the gateway i receive this

{"level":40,"time":"2023-08-21T10:38:33.284Z","pid":25013,"hostname":"chat","name":"Push","msg":"Error sending push to gateway (not authorized) '{\"detail\":\"Given token not valid for any token type\",\"code\":\"token_not_valid\",\"messages\":[{\"token_class\":\"AccessToken\",\"token_type\":\"access\",\"message\":\"Token is invalid or expired\"}]}'"}