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
Jinja2

Does symphony bot (messaging) support jinja2?

Votes Newest

Answers


Jinja2 works natively together with the BDK for Python rather than requiring a BDK-specific dependency like for Freemarker or Handlebars in BDK for Java. If you are using the Symphony Generator to create a new BDK for Python project, it already ships with an example that demonstrates how to integrate Jinja2 templates with the Activities API.

Here's a simple example of how to use Jinja2 in a bot that just sends a templated message and terminates:

from jinja2 import Template


async def run():
    config = BdkConfigLoader.load_from_file(Path.joinpath(current_dir, 'resources', 'config.yaml'))

    async with SymphonyBdk(config) as bdk:
        template = Template(open('resources/my_template.jinja2').read(), autoescape=True)
        message = template.render(some_key='some_value')
        await bdk.messages().send_message(stream_id, message)
  
  
Posted 2 years ago
Yong Sheng Tan
39 × 2 Administrator