Examples: query, "exact match", wildcard*, wild?ard, wild*rd
Fuzzy search: cake~ (finds cakes, bake)
Term boost: "red velvet"^4, chocolate^2
Field grouping: tags:(+work -"fun-stuff")
Escape special characters +-&|!(){}[]^"~*?:\ - e.g. \+ \* \!
Range search: properties.timestamp:[1587729413488 TO *] (inclusive), properties.title:{A TO Z}(excluding A and Z)
Combinations: chocolate AND vanilla, chocolate OR vanilla, (chocolate OR vanilla) NOT "vanilla pudding"
Field search: properties.title:"The Title" AND text
Answered
How to get room name from Stream ID

could anyone suggest an easiest way to retrive chat room name from Stream Id

  
  
Posted 11 months ago
Edited 11 months ago
  
  

could you provide solution in java language using Spring Boot and not Symphony Bdk

kunaal bokadia   11 months ago Report
Votes Newest

Answers 3


Hi Kunaal,
Here is another example using Java Spring Boot

public class EchoActivity {

  @Autowired
  private MessageService messageService;

  @Autowired
  private StreamService streamService;

  @Slash("/echo {argument}")
  public void echo(CommandContext context, String argument) {
    V2StreamAttributes Stream = streamService.getStream(context.getStreamId());
    log.info(Stream.toString());
    this.messageService.send(context.getStreamId(), "Received argument: " + argument);
  }
}
  
  
Posted 11 months ago
Vinay Mistry
23 × 2 Administrator

Hi Kunaal,
Here is an example for Java. Note. the class names are usually similar between our Python and Java BDK's.

@Slf4j
public class Example {
  public static final String STREAM_ID = "MY_STRING_UD";

  public static void main(String[] args) throws Exception {
    // Create BDK entry point
    final SymphonyBdk bdk = new SymphonyBdk(loadFromClasspath("/config.yaml"));

    // Get stream details
    StreamService streams = bdk.streams();
    V2StreamAttributes stream = streams.getStream(STREAM_ID);
    log.info("Stream details: " + stream);
  }
}
  
  
Posted 11 months ago
Vinay Mistry
23 × 2 Administrator

Hi Kunaal,
You can obtain information about a stream using the Stream Info endpoint.

Here is an example of how it can be used with the Python BDK

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.

  
  
Posted 11 months ago
Edited 11 months ago
Vinay Mistry
23 × 2 Administrator
  
  

could you provide solution for above question in java language?

kunaal bokadia   11 months ago Report