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
External Contacts for Bots

We are trying to add external contact to our bot, which is asking to send request. How can this be done using Python SDK?

  
  
Posted 3 years ago
Votes Newest

Answers


Your bot will either need to send connection requests to external contacts, accept their incoming connection requests, or both, depending on what your workflow is. You can use the connections client's create or accept calls. If you want to accept connection requests as they arrive in real-time, you can create a connections listener and call accept with the incoming user id, but you will want to build some sort of governance to ensure that you are not accepting anyone who asks. You can validate against the incoming request's email, for example, and maybe restrict it to a domain name.

# Python BDK Example
class MyConnectionsListener(RealTimeEventListener):
    def __init__(self, connections: ConnectionService):
        self._connections = connections

    async def on_connection_requested(self, initiator: V4Initiator, event: V4ConnectionRequested):
        email = initiator.user.email
        if (email.endswith("@my-trusted-bank.com")):
            self._connections.accept_connection(initiator.user.user_id)
            logging.info(f"Accepted connection request from {email}")
        else:
            logging.info(f"Rejected connection request from {email}")
  
  
Posted 3 years ago
Edited 3 years ago
Yong Sheng Tan
39 × 2 Administrator
9K Views
1 Answer
3 years ago
3 years ago
Tags