cancel
Showing results for 
Search instead for 
Did you mean: 

[SAP CAI API] How to get skills actions / messages with API?

former_member829286
Discoverer
0 Kudos

Hi,

We are building a bot on SAP CAI plateform, and using our webchat to interact with users on websites.

So, we use CAI API to get actions / messages from user’s messages in input.
We create rich scenarios on the platform, and we want to add buttons to trigger skills.

Our issue is : from our webchat we can trigger a click on button, but with API, we don’t know how to get associated actions from a skill. We didn’t find any endpoint in this way.
We tried with “Postback” or “Trigger Skill” buttons, with same results.

So, if you have any suggestion to get a list of actions except with /request endpoint, let me know!

Thanks a lot !

Regards,

Romain

Accepted Solutions (0)

Answers (1)

Answers (1)

timothy_janssen
Explorer
0 Kudos

Hello,

I am not sure I understand the issue. Can you describe what you are trying to do in more detail?

In the meantime, here are a few points that might help:

The webchat and webclient send messages (or other user interactions) to the /connect/v1/webhook/{{channel-id}} endpoint

This endpoint maps the channel to the configured environment and calls the /dialog endpoint

/dialog returns the processed nlp and the associated skill/actions that were triggered

here is the help guide for message types https://help.sap.com/viewer/a4522a393d2b4643812b7caadfe90c18/latest/en-US/ad3681adae824f8a96cbcf8b88...

And a sample payload for sending a skill trigger button to the conversation:

{ message: { chatId: "conversation_id", attachment: { type: "button", content: { title: "TITLE " type: "trigger_skill" value: "Skill GUID" // example "2cc00f8d-020c-88a2-9264-0d107f65b842" } } }}

Best,

Tim

former_member829286
Discoverer
0 Kudos

Hello Tim,

Thanks for your reply.

We did'nt use SAP webchat but our webchat.
When users write a text message on our webchat, we send the sentence in /request SAP CAI API endpoint to get messages (that we previously declare in Actions tab on the plaform) and display them to the user on the webchat. This works fine, no problem!

What we want to do is : use button type in Actions tab, to create buttons in conversation and trigger skill when user click on them. But our question is, how can we get all messages / actions associated to specific skill (to send these messages to users)?
So we just want to retrieve all actions we declare in Actions tab on the plateform (but without trigger the skill with sentence but with a skill ID or something else).

Is it more clear?

Regards,

Romain

timothy_janssen
Explorer
0 Kudos

Ok, I think there is some confusion.

As mentioned in the API doc (https://reverseproxy.cai.tools.sap/docs/api-reference/?shell#analyse-endpoints), /request only returns the NLP related information. /request does not execute skills or return messages that would be sent if the skill were executed. So I am very unsure of what you are displaying from the results of a /request call.

Instead, you require /dialog (https://reverseproxy.cai.tools.sap/docs/api-reference/?shell#dialog-endpoints). This endpoint manages the dialog between the user and the bot. It accepts messages of different types and executes the bot logic based on the input (ie. processes NLP, triggers skills, executes actions, etc).

If you have a button in the chat window that is supposed to trigger a skill and the user clicks it, you would need to send a request to /dialog with the message I described above.

This won't "retrieve all actions", since there are actions like set memory and call API, but it will return all the messages that get returned by the skill execution (along with the NLP output, current state of the memory, etc).

former_member829286
Discoverer
0 Kudos

Ok thanks Tim that's exactly what I want!

But, when I look the /dialog documentation, I see "message" parameter that is required in this format "{ type: ‘text’, content: ‘YOUR_TEXT’}"

So, what am I supposed to put in "content" to "simulate" a click on a button from user? (because what I want to get is the list of messages associated with the button).

timothy_janssen
Explorer

Hey Rom,

Sorry for the delay, it took some time to track down the exact message format.

Here is the format for the /dialog endpoint for the button skill trigger:

{
  "message": {
    "attachment": {
      "type":"action",
      "content":"<actual skill uuid>"      
    }
  }
  ...
}