Emit session event
curl --request POST \
--url https://general-runtime.voiceflow.com/v2/project/{projectID}/session/{sessionKey}/event \
--header 'Content-Type: application/json' \
--header 'authorization: <api-key>' \
--data '
{
"action": {
"type": "<string>",
"payload": "<unknown>",
"diagramID": "<string>",
"time": 123,
"metadata": {}
}
}
'import requests
url = "https://general-runtime.voiceflow.com/v2/project/{projectID}/session/{sessionKey}/event"
payload = { "action": {
"type": "<string>",
"payload": "<unknown>",
"diagramID": "<string>",
"time": 123,
"metadata": {}
} }
headers = {
"authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
action: {
type: '<string>',
payload: '<unknown>',
diagramID: '<string>',
time: 123,
metadata: {}
}
})
};
fetch('https://general-runtime.voiceflow.com/v2/project/{projectID}/session/{sessionKey}/event', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://general-runtime.voiceflow.com/v2/project/{projectID}/session/{sessionKey}/event",
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([
'action' => [
'type' => '<string>',
'payload' => '<unknown>',
'diagramID' => '<string>',
'time' => 123,
'metadata' => [
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"authorization: <api-key>"
],
]);
$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 := "https://general-runtime.voiceflow.com/v2/project/{projectID}/session/{sessionKey}/event"
payload := strings.NewReader("{\n \"action\": {\n \"type\": \"<string>\",\n \"payload\": \"<unknown>\",\n \"diagramID\": \"<string>\",\n \"time\": 123,\n \"metadata\": {}\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("authorization", "<api-key>")
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("https://general-runtime.voiceflow.com/v2/project/{projectID}/session/{sessionKey}/event")
.header("authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"action\": {\n \"type\": \"<string>\",\n \"payload\": \"<unknown>\",\n \"diagramID\": \"<string>\",\n \"time\": 123,\n \"metadata\": {}\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://general-runtime.voiceflow.com/v2/project/{projectID}/session/{sessionKey}/event")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"action\": {\n \"type\": \"<string>\",\n \"payload\": \"<unknown>\",\n \"diagramID\": \"<string>\",\n \"time\": 123,\n \"metadata\": {}\n }\n}"
response = http.request(request)
puts response.read_bodyEmit session event
Emits an event to an ongoing conversation session.
POST
/
v2
/
project
/
{projectID}
/
session
/
{sessionKey}
/
event
Emit session event
curl --request POST \
--url https://general-runtime.voiceflow.com/v2/project/{projectID}/session/{sessionKey}/event \
--header 'Content-Type: application/json' \
--header 'authorization: <api-key>' \
--data '
{
"action": {
"type": "<string>",
"payload": "<unknown>",
"diagramID": "<string>",
"time": 123,
"metadata": {}
}
}
'import requests
url = "https://general-runtime.voiceflow.com/v2/project/{projectID}/session/{sessionKey}/event"
payload = { "action": {
"type": "<string>",
"payload": "<unknown>",
"diagramID": "<string>",
"time": 123,
"metadata": {}
} }
headers = {
"authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
action: {
type: '<string>',
payload: '<unknown>',
diagramID: '<string>',
time: 123,
metadata: {}
}
})
};
fetch('https://general-runtime.voiceflow.com/v2/project/{projectID}/session/{sessionKey}/event', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://general-runtime.voiceflow.com/v2/project/{projectID}/session/{sessionKey}/event",
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([
'action' => [
'type' => '<string>',
'payload' => '<unknown>',
'diagramID' => '<string>',
'time' => 123,
'metadata' => [
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"authorization: <api-key>"
],
]);
$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 := "https://general-runtime.voiceflow.com/v2/project/{projectID}/session/{sessionKey}/event"
payload := strings.NewReader("{\n \"action\": {\n \"type\": \"<string>\",\n \"payload\": \"<unknown>\",\n \"diagramID\": \"<string>\",\n \"time\": 123,\n \"metadata\": {}\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("authorization", "<api-key>")
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("https://general-runtime.voiceflow.com/v2/project/{projectID}/session/{sessionKey}/event")
.header("authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"action\": {\n \"type\": \"<string>\",\n \"payload\": \"<unknown>\",\n \"diagramID\": \"<string>\",\n \"time\": 123,\n \"metadata\": {}\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://general-runtime.voiceflow.com/v2/project/{projectID}/session/{sessionKey}/event")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"action\": {\n \"type\": \"<string>\",\n \"payload\": \"<unknown>\",\n \"diagramID\": \"<string>\",\n \"time\": 123,\n \"metadata\": {}\n }\n}"
response = http.request(request)
puts response.read_bodyThis endpoint only works when the target session has an open websocket connection, such as through the web chat widget or a custom websocket integration. If no active connection exists, the event will have no effect.
Authorizations
Voiceflow API key
Path Parameters
ID of the target Voiceflow project.
The session key returned by the Start session endpoint. Identifies which active session to send the event to.
Body
application/json
Response
201 - undefined
Was this page helpful?
⌘I