Reputation: 373
I am new in work with Rocket.Chat. I need send message to channel. I already get authorization. When I read documentation about send message I found roomId parameter, but I don't know how get this ID. I try found in administration panel on Rocket.Chat but without success. Also if who know, how get access to Rocket.Chat database
Thanks
Upvotes: 6
Views: 8219
Reputation: 248
For accessing the database you can use Robo 3t (how to use it with meteor How to connect mongodb clients to local Meteor MongoDB).
Or you can use the rest api to get the channel info https://developer.rocket.chat/reference/api/rest-api/endpoints/core-endpoints/channels-endpoints/info
Upvotes: 8
Reputation: 166
{
"msg": "method",
"method": "createDirectMessage",
"id": "42",
"params": ["username-goes-here"]
}
use createDirectMessage api, you have to pass usernames of those users you want to create room for. If you don't send any user, a room that have only you will be created.
this api will return roomId of the created room. Below is the response of above api.
{
"msg": "result",
"id": "42",
"result": {
"rid": "room-id-would-be-here"
}
}
Every time you hit createDirectMessage api with same list of users, same roomId will be returned.
Upvotes: 0
Reputation: 21
First, call the API create-visitor to create a visitor and in response, you will get a token, use in next API open-room to open a room and in response, you will get room-id.
Upvotes: 0
Reputation: 2246
I'm assuming that you are using the APIs to send messages, if yes then you will be the one who created the channels (rooms).
When you create a new channel, the response contains details about the newly created channel, which includes the generated _id
.
In this case, whenever you create a new channel, store it somewhere within your data storage, then restore it using the name of the channel, this will save you a journey to Roekct APIs each time you need to get the roomId.
Upvotes: 0