Skip to Content
Jun 15 at 07:49 AM

Can we modify both the bot memory and send a reply to the client in one request?

210 Views Last edit Jun 15 at 09:25 AM 3 rev


Is there a way to add bot replies and alter bot memory to a conversation outside of the webhook flow?
Meaning I need to do these operations in one request and SAP CAI hasn't initiated the request.

I know of
PUT URL_PREFIX/build/v1/users/$USER_SLUG/bots/$BOT_SLUG/versions/$VERSION_SLUG/builder/conversation_states/$CONVERSATION_ID and
POST URL_PREFIX/connect/v1/conversations/$CONVERSATION_ID/messages

Is there a way to do this in one api call? I would like to avoid the possibility that one request succeeds and 1 fails leaving the bot state in an inconsistent manner.

I've tried the /dialog api and here are some quirks, each of them is unacceptable:
- all messages sent to /dialog will be considered client sent and not bot replies.
- all messages send to /dialog will be nlp/builder processed, resulting in actions pinging backends changing state and producing other replies.
- all messages and replies from /dialog will not be sent to the chat as the bot connector did not proxy these calls and is not aware of them.

As a result using the /dialog api is a side-effect inducing way of setting just the bot's memory.

Thank you