How to get room name from Stream ID
How to get room name from Stream ID
Hi Kunaal,
You can obtain information about a stream using the [Stream Info](https://developers.symphony.com/restapi/reference/stream-info-v2) endpoint.
Here is an example of how it can be used with the Python BDK
```python
async def help_command(self, context: CommandContext):
room = await self.bdk.streams().get_stream(context.stream_id)
logging.debug(room)
return await self._messages.send_message(context.stream_id, "<messageML>Help command triggered</messageML>")
```
The returned results from the `get_stream` call is shown below. One of the attributes returned is the room name,
```
2023-03-13 15:19:40,517 - root - DEBUG - {'active': True,
'cross_pod': True,
'id': '3MKJswHOSZGM_smkhuG2vn___nkkg9oTdA',
'last_message_date': 1678720779156,
'origin': 'EXTERNAL',
'room_attributes': {'name': 'My Room'},
'stream_type': {'type': 'ROOM'}}
```
Hope that helps.
Hi Kunaal,
You can obtain information about a stream using the [Stream Info](https://developers.symphony.com/restapi/reference/stream-info-v2) endpoint.
Here is an example of how it can be used with the Python BDK
```python
async def help_command(self, context: CommandContext):
room = await self.bdk.streams().get_stream(context.stream_id)
logging.debug(room)
return await self._messages.send_message(context.stream_id, "<messageML>Help command triggered</messageML>")
```
The returned results from the `get_stream` call is shown below. One of the attributes returned is the room name,
```
2023-03-13 15:19:40,517 - root - DEBUG - {'active': True,
'cross_pod': True,
'id': '3MKJswHOSZGM_smkhuG2vn___nkkg9oTdA',
'last_message_date': 1678720779156,
'origin': 'EXTERNAL',
'room_attributes': {'name': 'My Room'},
'stream_type': {'type': 'ROOM'}}
```
Hope that helps.
How to get room name from Stream ID
Hi Kunaal,
You can obtain information about a stream using the [Stream Info](https://developers.symphony.com/restapi/reference/stream-info-v2) endpoint.
Here is an example of how it can be used with the Python BDK
```python
async def help_command(self, context: CommandContext):
room = await self.bdk.streams().get_stream(context.stream_id)
logging.debug(room)
return await self._messages.send_message(context.stream_id, "<messageML>Help command triggered</messageML>")
```
The returned results from the `get_stream` call is shown below. One of the attributes returned is the room name,
```
2023-03-13 15:19:40,517 - root - DEBUG - {'active': True,
'cross_pod': True,
'id': '3MKJswHOSZGM_smkhuG2vn___nkkg9oTdA',
'last_message_date': 1678720779156,
'origin': 'EXTERNAL',
'room_attributes': {'name': 'My Room'},
'stream_type': {'type': 'ROOM'}}
```
Hope that helps.