Closed ueen closed 3 years ago
Pushbits always uses the matrix account set in the config (or via environment variables) to send messages from. You can have multiple receiving users, you need to create a pushbits account for each matrix account you want to send messages to, as each puhsbits user is mapped to one matrix account.
Each pushbits user then can hold multiple "applications". One application matches on channel in matrix. For such a application you can get a token, if you send a message with a token to pushbits it does look up which application the token belongs to and which user the application belongs to and then sends the message to that user and the specific channel.
If your usecase is to send all messages to more then one user you also could try to invite other matrix users to the channel created by a pushbits application, but idk if that works.
In general you might want to take a look at the command line tool for pushbits server, that makes managing it much easier.
Ok I think then that's not it, I can't manually set users, I want the user to give me their handle and then just send them messages.
Hi @ueen, maybe to elaborate on what @CubicrootXYZ said: you can create a new user if that user does not exist using the API. When creating the user, you can specify their Matrix handle. After this, you create a new application, specifiying the name of the channel the user should receive the message in. This will create a token for this specific relation between user and application. You can store this token in your application, and then instead of sending a message to a Matrix handle, you provide the token to PushBits. Maybe a little hacky, but at least you don't have to deal with Matrix at all.
Edit: In summary, you need to setup the PushBits account once per user (can be done from within your application), but after that you can send Matrix messages by issuing a single request from your application (providing the token instead of the Matrix handle).
Thanks for the support!
Ah that won't work, the request comes from the user client (js)
Okay, I see. Well, unfortunately then I don't see a way either with the current setup. Good luck going forward!
Hey, how can i post a simple message plus matrix handle to a pushbits server to send to from js? Or how does the json needs to be structured exactly? (whats the token, is it required?)
To state it differently, my usecase is this: i want to send a message and a receiver "@user:matrix.org" to a server and the server should just relay the message to the receiver, can pushbits do that? :)