Record a first-party suggested-question usage event
curl --request POST \
--url https://api.getmodus.com/api/v1/suggestions/questions/{id}/events \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"eventType": "clicked",
"source": "home",
"skillId": 42
}
'import requests
url = "https://api.getmodus.com/api/v1/suggestions/questions/{id}/events"
payload = {
"eventType": "clicked",
"source": "home",
"skillId": 42
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({eventType: 'clicked', source: 'home', skillId: 42})
};
fetch('https://api.getmodus.com/api/v1/suggestions/questions/{id}/events', 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://api.getmodus.com/api/v1/suggestions/questions/{id}/events",
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([
'eventType' => 'clicked',
'source' => 'home',
'skillId' => 42
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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 := "https://api.getmodus.com/api/v1/suggestions/questions/{id}/events"
payload := strings.NewReader("{\n \"eventType\": \"clicked\",\n \"source\": \"home\",\n \"skillId\": 42\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://api.getmodus.com/api/v1/suggestions/questions/{id}/events")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"eventType\": \"clicked\",\n \"source\": \"home\",\n \"skillId\": 42\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getmodus.com/api/v1/suggestions/questions/{id}/events")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"eventType\": \"clicked\",\n \"source\": \"home\",\n \"skillId\": 42\n}"
response = http.request(request)
puts response.read_body{
"error": {
"code": "BAD_REQUEST",
"status": "INVALID_ARGUMENT",
"message": "Invalid value for query parameter `pageSize`.",
"requestId": "req_01HQ7K8ABCDEFGHIJKLMNOPQRS"
}
}{
"error": {
"code": "UNAUTHORIZED",
"status": "UNAUTHENTICATED",
"message": "Missing or invalid access token.",
"requestId": "req_01HQ7K8ABCDEFGHIJKLMNOPQRS"
}
}{
"error": {
"code": "FORBIDDEN",
"status": "PERMISSION_DENIED",
"message": "Missing required scope(s) for this operation.",
"requestId": "req_01HQ7K8ABCDEFGHIJKLMNOPQRS",
"info": {
"missing": [
"<required-scope>"
]
}
}
}{
"error": {
"code": "NOT_FOUND",
"status": "NOT_FOUND",
"message": "Resource not found.",
"requestId": "req_01HQ7K8ABCDEFGHIJKLMNOPQRS"
}
}{
"error": {
"code": "CONFLICT",
"status": "ALREADY_EXISTS",
"message": "A resource with that identifier already exists.",
"requestId": "req_01HQ7K8ABCDEFGHIJKLMNOPQRS"
}
}{
"error": {
"code": "VALIDATION",
"status": "INVALID_ARGUMENT",
"message": "Updates that would revoke your own access are not allowed.",
"requestId": "req_01HQ7K8ABCDEFGHIJKLMNOPQRS"
}
}{
"error": {
"code": "INTERNAL_ERROR",
"status": "INTERNAL",
"message": "An unexpected error occurred.",
"requestId": "req_01HQ7K8ABCDEFGHIJKLMNOPQRS"
}
}Suggestions
Record a first-party suggested-question usage event
Records Home suggestion interactions without relying on external analytics. Unknown suggestion ids return not found.
Requires: scopes:read
POST
/
api
/
v1
/
suggestions
/
questions
/
{id}
/
events
Record a first-party suggested-question usage event
curl --request POST \
--url https://api.getmodus.com/api/v1/suggestions/questions/{id}/events \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"eventType": "clicked",
"source": "home",
"skillId": 42
}
'import requests
url = "https://api.getmodus.com/api/v1/suggestions/questions/{id}/events"
payload = {
"eventType": "clicked",
"source": "home",
"skillId": 42
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({eventType: 'clicked', source: 'home', skillId: 42})
};
fetch('https://api.getmodus.com/api/v1/suggestions/questions/{id}/events', 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://api.getmodus.com/api/v1/suggestions/questions/{id}/events",
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([
'eventType' => 'clicked',
'source' => 'home',
'skillId' => 42
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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 := "https://api.getmodus.com/api/v1/suggestions/questions/{id}/events"
payload := strings.NewReader("{\n \"eventType\": \"clicked\",\n \"source\": \"home\",\n \"skillId\": 42\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://api.getmodus.com/api/v1/suggestions/questions/{id}/events")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"eventType\": \"clicked\",\n \"source\": \"home\",\n \"skillId\": 42\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getmodus.com/api/v1/suggestions/questions/{id}/events")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"eventType\": \"clicked\",\n \"source\": \"home\",\n \"skillId\": 42\n}"
response = http.request(request)
puts response.read_body{
"error": {
"code": "BAD_REQUEST",
"status": "INVALID_ARGUMENT",
"message": "Invalid value for query parameter `pageSize`.",
"requestId": "req_01HQ7K8ABCDEFGHIJKLMNOPQRS"
}
}{
"error": {
"code": "UNAUTHORIZED",
"status": "UNAUTHENTICATED",
"message": "Missing or invalid access token.",
"requestId": "req_01HQ7K8ABCDEFGHIJKLMNOPQRS"
}
}{
"error": {
"code": "FORBIDDEN",
"status": "PERMISSION_DENIED",
"message": "Missing required scope(s) for this operation.",
"requestId": "req_01HQ7K8ABCDEFGHIJKLMNOPQRS",
"info": {
"missing": [
"<required-scope>"
]
}
}
}{
"error": {
"code": "NOT_FOUND",
"status": "NOT_FOUND",
"message": "Resource not found.",
"requestId": "req_01HQ7K8ABCDEFGHIJKLMNOPQRS"
}
}{
"error": {
"code": "CONFLICT",
"status": "ALREADY_EXISTS",
"message": "A resource with that identifier already exists.",
"requestId": "req_01HQ7K8ABCDEFGHIJKLMNOPQRS"
}
}{
"error": {
"code": "VALIDATION",
"status": "INVALID_ARGUMENT",
"message": "Updates that would revoke your own access are not allowed.",
"requestId": "req_01HQ7K8ABCDEFGHIJKLMNOPQRS"
}
}{
"error": {
"code": "INTERNAL_ERROR",
"status": "INTERNAL",
"message": "An unexpected error occurred.",
"requestId": "req_01HQ7K8ABCDEFGHIJKLMNOPQRS"
}
}Authorizations
A Modus personal access token (modus_<orgUuid>_<prefix>_<secret>) or an OAuth 2.1 access token, sent as Authorization: Bearer <token>.
Path Parameters
Stable suggestion id.
Example:
"7a3f9d2c-1111-4000-a000-000000000abc"
Body
application/json
First-party Home suggestion interaction.
Available options:
shown, clicked, dismissed, submitted Example:
"clicked"
Product surface that emitted the event.
Available options:
home Example:
"home"
Selected Home scope id when known.
Conversation thread id when the event is tied to a chat.
Event metadata.
Response
⌘I