Add methos to send custom json to the cat via WS
Closed this issue ยท 3 comments
cristianorevil commented
๐ The feature, motivation and pitch
The actually send method (cat_client.py line 120) send a ws message with only "text" parameter. To permit a better integrations with 3rd party tools can be useful to have a second method (eg send_with_params) that permit to send a custom json in additional to text, eg:
"text": message,
"custom_settings": json_string
Obviously this additional setting need to be managed by a plugin on cat server side.
Alternatives
No response
Additional context
No response
nicola-corbellini commented
Hello! This is already possible using kwargs
in the send
method
cristianorevil commented
Oh sorry, there is some examples?
nicola-corbellini commented
actually not, the documentation should be improved.
Here is an example
# assuming you have instantiated the client
cat_client.send(text="your text", custom_key=42, custom_key2="another string")
the JSON to be sent will be
{
"text": "your text",
"custom_key": 42,
"custom_key2": "another string"
}