Passing extra data while executing action through API

I want to execute action using this API /conversations/{sender_id}/execute

Can I pass some other data in request as shown below

{ 
  "action": "utter_show_book" ,
  "book_id": "5hdh3werq55"
}

Any update on this? This is basic requirement, we might want to pass some information explicitly to this message

@r4sn4

According to the documentation, this is not possible:

But why not try to previously add a message to the tracker which could be parsed in the execution then:

http://localhost:5005//conversations/{conversation_id}/messages

{
  "text": "Hello!",
  "sender": "user",
  "parse_data": {
    "entites": [
      {
        "start": 0,
        "end": 0,
        "value": "string",
        "entity": "string",
        "confidence": 0
      }
    ],
    "intent": {
      "confidence": 0.6323,
      "name": "greet"
    },
    "intent_ranking": [
      {
        "confidence": 0.6323,
        "name": "greet"
      }
    ],
    "text": "Hello!"
  }
}

Would that fit your situation? If not, you may want to extend the conversations API yourself?

Regards

It won’t fit in this case

Hello,

Is your use something like this? If the user types in a book name, you want to send the corresponding ID to the bot? Probably because these patterns are easier to recognize?

In my case, I want some services to interact with bot and cache information provided by such services. Here user is not interacting with bot. Instead, some service is interacting with bot

Oh okay, got it.

I had similar issues where I wanted to send additional information and couldn’t modify the request structure. I managed it by using buttons and some modifications in the front end, but mine was a different use case.

@r4sn4 Okay!

Then I think you might want to consider modifying server.py, where the endpoint lies. Something like:

policy = request_params.get("policy", None)
confidence = request_params.get("confidence", None)
additional_information = request_params.get("additional_information", None)

verbosity = event_verbosity_parameter(request, EventVerbosity.AFTER_RESTART)

try:
    out = CollectingOutputChannel()
    await app.agent.execute_action(
        conversation_id, action_to_execute, out, policy, confidence, additional_information
    )

I don’t know how update-secure your project has to be but I don’t think the API is modified pretty often…

How about that?

Regards