INNER CODE UNIT · Python
listen
opsdroid/opsdroid · opsdroid/connector/facebook/__init__.py:103
async def listen(self):
"""Listen for new message.
Listening is handled by the aiohttp web server
"""
@register_event(Message)
async def send_message(self, message):
"""Respond with a message."""
_LOGGER.debug(_("Responding to Facebook."))
url = _FACEBOOK_SEND_URL.format(self.config.get("page-access-token"))
headers = {"content-type": "application/json"}
payload = {
"recipient": {"id": message.target},
"message": {"text": message.text},
}
async with aiohttp.ClientSession(trust_env=True) as session: