Inject an intent into a conversation
Sends a specified intent and list of entities in place of a user message. The bot then predicts and executes a response action. Any responses sent by the executed action will be forwarded to the channel specified in the output_channel parameter. If no output channel is specified, any messages that should be sent to the user will be included in the response of this endpoint.
curl --request POST \
--url 'http://localhost:5005/conversations/{conversation_id}/trigger_intent?token=' \
--header 'Content-Type: application/json' \
--data '
{
"name": "greet",
"entities": {
"temperature": "high"
}
}
'import requests
url = "http://localhost:5005/conversations/{conversation_id}/trigger_intent?token="
payload = {
"name": "greet",
"entities": { "temperature": "high" }
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({name: 'greet', entities: {temperature: 'high'}})
};
fetch('http://localhost:5005/conversations/{conversation_id}/trigger_intent?token=', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "5005",
CURLOPT_URL => "http://localhost:5005/conversations/{conversation_id}/trigger_intent?token=",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'greet',
'entities' => [
'temperature' => 'high'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://localhost:5005/conversations/{conversation_id}/trigger_intent?token="
payload := strings.NewReader("{\n \"name\": \"greet\",\n \"entities\": {\n \"temperature\": \"high\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://localhost:5005/conversations/{conversation_id}/trigger_intent?token=")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"greet\",\n \"entities\": {\n \"temperature\": \"high\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:5005/conversations/{conversation_id}/trigger_intent?token=")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"greet\",\n \"entities\": {\n \"temperature\": \"high\"\n }\n}"
response = http.request(request)
puts response.read_body{
"tracker": {
"sender_id": "default",
"user_id": "usr_a1b2c3d4e5f6",
"current_session_id": "4b3c1e2a-91f0-4d8e-b123-abc123def456",
"slots": [
{
"slot_name": "slot_value"
}
],
"latest_message": {
"text": "Hello!",
"entities": [
{
"start": 123,
"end": 123,
"value": "<string>",
"entity": "<string>",
"confidence": 123
}
],
"intent": {
"confidence": 0.6323,
"name": "greet"
},
"intent_ranking": [
{
"confidence": 0.6323,
"name": "greet"
}
],
"message_id": "b2831e73-1407-4ba0-a861-0f30a42a2a5a",
"metadata": {},
"commands": [
{
"command": "start flow",
"flow": "transfer_money"
}
],
"flows_from_semantic_search": [
[
"transfer_money"
]
],
"flows_in_prompt": [
"transfer_money"
]
},
"latest_event_time": 1537645578.314389,
"followup_action": "<string>",
"paused": false,
"stack": [
{
"frame_id": "8UJPHH5C",
"flow_id": "transfer_money",
"step_id": "START",
"frame_type": "regular",
"type": "flow"
}
],
"events": [
{
"event": "user",
"timestamp": 1774447464.622012,
"metadata": {
"session_id": "eed351b9-a996-4bb8-83ea-1d18e7cd4905",
"model_id": "80687713793f4d07957e8e51f73df866",
"assistant_id": "my-assistant"
},
"text": "<string>",
"input_channel": "<string>",
"message_id": "<string>",
"parse_data": {
"text": "Hello!",
"entities": [
{
"start": 123,
"end": 123,
"value": "<string>",
"entity": "<string>",
"confidence": 123
}
],
"intent": {
"confidence": 0.6323,
"name": "greet"
},
"intent_ranking": [
{
"confidence": 0.6323,
"name": "greet"
}
],
"message_id": "b2831e73-1407-4ba0-a861-0f30a42a2a5a",
"metadata": {},
"commands": [
{
"command": "start flow",
"flow": "transfer_money"
}
],
"flows_from_semantic_search": [
[
"transfer_money"
]
],
"flows_in_prompt": [
"transfer_money"
]
},
"anonymized_at": "<string>"
}
],
"latest_input_channel": "rest",
"latest_action_name": "action_listen",
"latest_action": {
"action_name": "<string>",
"action_text": "<string>"
},
"active_loop": {
"name": "restaurant_form"
}
},
"messages": [
{
"recipient_id": "<string>",
"text": "<string>",
"image": "<string>",
"buttons": [
{
"title": "<string>",
"payload": "<string>"
}
],
"attachement": [
{
"title": "<string>",
"payload": "<string>"
}
]
}
]
}{
"version": "1.0.0",
"status": "failure",
"reason": "BadRequest",
"code": 400
}{
"version": "1.0.0",
"status": "failure",
"reason": "NotAuthenticated",
"message": "User is not authenticated to access resource.",
"code": 401
}{
"version": "1.0.0",
"status": "failure",
"reason": "NotAuthorized",
"message": "User has insufficient permission to access resource.",
"code": 403
}{
"version": "1.0.0",
"status": "failure",
"reason": "Conflict",
"message": "The request conflicts with the currently loaded model.",
"code": 409
}{
"version": "1.0.0",
"status": "ServerError",
"message": "An unexpected error occurred.",
"code": 500
}Authorizations
A plaintext token to secure your server, specified at startup in the argument --auth-token thisismysecret
Path Parameters
Id of the conversation
Query Parameters
Specify which events of the tracker the response should contain.
-
ALL- every logged event. -
APPLIED- only events that contribute to the trackers state. This excludes reverted utterances and actions that got undone. -
AFTER_RESTART- all events since the lastrestartedevent. This includes utterances that got reverted and actions that got undone. -
NONE- no events.
ALL, APPLIED, AFTER_RESTART, NONE The bot's utterances will be forwarded to this channel. It uses the credentials listed in credentials.yml to connect. In case the channel does not support this, the utterances will be returned in the response body. Use latest to try to send the messages to the latest channel the user used. Currently supported channels are listed in the permitted values for the parameter.
latest, slack, callback, facebook, rocketchat, telegram, twilio, webexteams, socketio Body
curl --request POST \
--url 'http://localhost:5005/conversations/{conversation_id}/trigger_intent?token=' \
--header 'Content-Type: application/json' \
--data '
{
"name": "greet",
"entities": {
"temperature": "high"
}
}
'import requests
url = "http://localhost:5005/conversations/{conversation_id}/trigger_intent?token="
payload = {
"name": "greet",
"entities": { "temperature": "high" }
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({name: 'greet', entities: {temperature: 'high'}})
};
fetch('http://localhost:5005/conversations/{conversation_id}/trigger_intent?token=', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "5005",
CURLOPT_URL => "http://localhost:5005/conversations/{conversation_id}/trigger_intent?token=",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'greet',
'entities' => [
'temperature' => 'high'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://localhost:5005/conversations/{conversation_id}/trigger_intent?token="
payload := strings.NewReader("{\n \"name\": \"greet\",\n \"entities\": {\n \"temperature\": \"high\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://localhost:5005/conversations/{conversation_id}/trigger_intent?token=")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"greet\",\n \"entities\": {\n \"temperature\": \"high\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:5005/conversations/{conversation_id}/trigger_intent?token=")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"greet\",\n \"entities\": {\n \"temperature\": \"high\"\n }\n}"
response = http.request(request)
puts response.read_body{
"tracker": {
"sender_id": "default",
"user_id": "usr_a1b2c3d4e5f6",
"current_session_id": "4b3c1e2a-91f0-4d8e-b123-abc123def456",
"slots": [
{
"slot_name": "slot_value"
}
],
"latest_message": {
"text": "Hello!",
"entities": [
{
"start": 123,
"end": 123,
"value": "<string>",
"entity": "<string>",
"confidence": 123
}
],
"intent": {
"confidence": 0.6323,
"name": "greet"
},
"intent_ranking": [
{
"confidence": 0.6323,
"name": "greet"
}
],
"message_id": "b2831e73-1407-4ba0-a861-0f30a42a2a5a",
"metadata": {},
"commands": [
{
"command": "start flow",
"flow": "transfer_money"
}
],
"flows_from_semantic_search": [
[
"transfer_money"
]
],
"flows_in_prompt": [
"transfer_money"
]
},
"latest_event_time": 1537645578.314389,
"followup_action": "<string>",
"paused": false,
"stack": [
{
"frame_id": "8UJPHH5C",
"flow_id": "transfer_money",
"step_id": "START",
"frame_type": "regular",
"type": "flow"
}
],
"events": [
{
"event": "user",
"timestamp": 1774447464.622012,
"metadata": {
"session_id": "eed351b9-a996-4bb8-83ea-1d18e7cd4905",
"model_id": "80687713793f4d07957e8e51f73df866",
"assistant_id": "my-assistant"
},
"text": "<string>",
"input_channel": "<string>",
"message_id": "<string>",
"parse_data": {
"text": "Hello!",
"entities": [
{
"start": 123,
"end": 123,
"value": "<string>",
"entity": "<string>",
"confidence": 123
}
],
"intent": {
"confidence": 0.6323,
"name": "greet"
},
"intent_ranking": [
{
"confidence": 0.6323,
"name": "greet"
}
],
"message_id": "b2831e73-1407-4ba0-a861-0f30a42a2a5a",
"metadata": {},
"commands": [
{
"command": "start flow",
"flow": "transfer_money"
}
],
"flows_from_semantic_search": [
[
"transfer_money"
]
],
"flows_in_prompt": [
"transfer_money"
]
},
"anonymized_at": "<string>"
}
],
"latest_input_channel": "rest",
"latest_action_name": "action_listen",
"latest_action": {
"action_name": "<string>",
"action_text": "<string>"
},
"active_loop": {
"name": "restaurant_form"
}
},
"messages": [
{
"recipient_id": "<string>",
"text": "<string>",
"image": "<string>",
"buttons": [
{
"title": "<string>",
"payload": "<string>"
}
],
"attachement": [
{
"title": "<string>",
"payload": "<string>"
}
]
}
]
}{
"version": "1.0.0",
"status": "failure",
"reason": "BadRequest",
"code": 400
}{
"version": "1.0.0",
"status": "failure",
"reason": "NotAuthenticated",
"message": "User is not authenticated to access resource.",
"code": 401
}{
"version": "1.0.0",
"status": "failure",
"reason": "NotAuthorized",
"message": "User has insufficient permission to access resource.",
"code": 403
}{
"version": "1.0.0",
"status": "failure",
"reason": "Conflict",
"message": "The request conflicts with the currently loaded model.",
"code": 409
}{
"version": "1.0.0",
"status": "ServerError",
"message": "An unexpected error occurred.",
"code": 500
}