controller.server_rest¶
This file contains the flask server.
Module Contents¶
Classes¶
Functions¶
|
Runs execute_agent in ControllerFlask and starts flask server. |
|
Receives POST requests send from client. |
|
Gets user id and payload from output and runs get_message in the |
|
Gets payload from output. |
Attributes¶
- controller.server_rest.app¶
- controller.server_rest.controller_flask¶
- class controller.server_rest.Message¶
- text: str¶
- quick_reply: Dict[str, str]¶
- postback: Dict[str, str]¶
- controller.server_rest.run(config: Dict[str, Any]) None¶
Runs execute_agent in ControllerFlask and starts flask server.
- Parameters
config – Agent configuration.
- controller.server_rest.receive_message() None¶
Receives POST requests send from client.
- controller.server_rest.action(output: Dict[str, Any]) Dict[str, Dict[str, str]]¶
Gets user id and payload from output and runs get_message in the controller.
The data should be sent with the following template: {
- “message”: {
“text”: “TEXT_SENT”, “quick_reply”: {“payload”: “QR_PAYLOAD”}, “postback”: {“payload”: “PB_PAYLOAD”},
}, “sender”: {“id”: “SENDER_ID”},
}
- Parameters
output – Output from request.
- Returns
Object with message to send to the server.
- controller.server_rest.get_message(output: Dict[str, Any]) str¶
Gets payload from output.
- Parameters
output – Output from request.
- Returns
String with payload.