Add Message to Chat
curl --request POST \
--url https://api.yourhomie.ai/v1/chats/{chatId}/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"message": "<string>",
"currentUrl": "<string>"
}
'import requests
url = "https://api.yourhomie.ai/v1/chats/{chatId}/messages"
payload = {
"message": "<string>",
"currentUrl": "<string>"
}
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({message: '<string>', currentUrl: '<string>'})
};
fetch('https://api.yourhomie.ai/v1/chats/{chatId}/messages', 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.yourhomie.ai/v1/chats/{chatId}/messages",
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([
'message' => '<string>',
'currentUrl' => '<string>'
]),
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.yourhomie.ai/v1/chats/{chatId}/messages"
payload := strings.NewReader("{\n \"message\": \"<string>\",\n \"currentUrl\": \"<string>\"\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.yourhomie.ai/v1/chats/{chatId}/messages")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"message\": \"<string>\",\n \"currentUrl\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.yourhomie.ai/v1/chats/{chatId}/messages")
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 \"message\": \"<string>\",\n \"currentUrl\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"chatId": "<string>",
"type": "<string>",
"content": "<string>",
"createdAt": "<string>",
"suggestions": [
"<string>"
],
"products": [
{
"gtin": "<string>",
"brand": "<string>",
"designation": "<string>",
"url": "<string>",
"image": "<string>",
"price": 123,
"currency": "<string>",
"priceInfo": "<string>",
"location": [
{
"key": "<string>",
"value": "<string>"
}
],
"availability": {
"status": "<string>",
"quantity": 123
},
"category": "<string>",
"query": "<string>",
"description": "<string>",
"recommendationText": "<string>",
"flags": [
{
"type": "<string>",
"title": "<string>",
"text": "<string>"
}
]
}
]
}Nachrichten
Nachricht hinzufügen
Sende eine Nutzernachricht an einen Chat und erhalte die Antwort des Assistenten.
POST
/
v1
/
chats
/
{chatId}
/
messages
Add Message to Chat
curl --request POST \
--url https://api.yourhomie.ai/v1/chats/{chatId}/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"message": "<string>",
"currentUrl": "<string>"
}
'import requests
url = "https://api.yourhomie.ai/v1/chats/{chatId}/messages"
payload = {
"message": "<string>",
"currentUrl": "<string>"
}
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({message: '<string>', currentUrl: '<string>'})
};
fetch('https://api.yourhomie.ai/v1/chats/{chatId}/messages', 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.yourhomie.ai/v1/chats/{chatId}/messages",
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([
'message' => '<string>',
'currentUrl' => '<string>'
]),
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.yourhomie.ai/v1/chats/{chatId}/messages"
payload := strings.NewReader("{\n \"message\": \"<string>\",\n \"currentUrl\": \"<string>\"\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.yourhomie.ai/v1/chats/{chatId}/messages")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"message\": \"<string>\",\n \"currentUrl\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.yourhomie.ai/v1/chats/{chatId}/messages")
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 \"message\": \"<string>\",\n \"currentUrl\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"chatId": "<string>",
"type": "<string>",
"content": "<string>",
"createdAt": "<string>",
"suggestions": [
"<string>"
],
"products": [
{
"gtin": "<string>",
"brand": "<string>",
"designation": "<string>",
"url": "<string>",
"image": "<string>",
"price": 123,
"currency": "<string>",
"priceInfo": "<string>",
"location": [
{
"key": "<string>",
"value": "<string>"
}
],
"availability": {
"status": "<string>",
"quantity": 123
},
"category": "<string>",
"query": "<string>",
"description": "<string>",
"recommendationText": "<string>",
"flags": [
{
"type": "<string>",
"title": "<string>",
"text": "<string>"
}
]
}
]
}Füge einem Chat eine Nutzernachricht hinzu. Der Assistent verarbeitet die Nachricht und gibt eine Antwort zurück, die Folgefragen und Produktempfehlungen enthalten kann.
Authentifizierung
Diese Anfrage benötigt deinen API-Key imx-api-key-Header.
Request
string
erforderlich
ID des Chats, dem die Nachricht hinzugefügt wird.
string
Optionaler Query-Parameter.
string
erforderlich
Der Nachrichtentext des Nutzers.
string
erforderlich
Die URL der Seite, die der Nutzer gerade betrachtet. Wird genutzt, um dem Assistenten den Seitenkontext zu geben.
Response
string
erforderlich
ID der erstellten Nachricht.
string
erforderlich
ID des Chats, zu dem die Nachricht gehört.
string
erforderlich
Der Nachrichtentyp, zum Beispiel ob sie vom Nutzer oder vom Assistenten stammt.
string
erforderlich
Der Textinhalt der Nachricht.
string[]
Optionale Liste vorgeschlagener Folgefragen.
object[]
Optionale Liste empfohlener Produkte.
Anzeigen MessageProductDto
Anzeigen MessageProductDto
string
erforderlich
Global Trade Item Number des Produkts.
string
erforderlich
Markenname.
string
erforderlich
Produktname oder Bezeichnung.
string
erforderlich
URL der Produktdetailseite.
string
erforderlich
URL des Produktbilds.
number
erforderlich
Produktpreis.
string
erforderlich
Währungscode des Preises, zum Beispiel
EUR.string
Zusätzliche Preisinformation.
object[]
object
string
Produktkategorie.
string
Suchanfrage, die das Produkt gefunden hat.
string
Produktbeschreibung.
string
Text, der erklärt, warum das Produkt empfohlen wird.
string
erforderlich
ISO-8601-Zeitstempel, wann die Nachricht erstellt wurde.
Um die gestreamte Antwort des Assistenten und Tool-Aktivität in Echtzeit zu empfangen, öffne den Nachrichten-Events-Stream für dieselbe
chatId.Beispiele
curl -X POST https://api.yourhomie.ai/v1/chats/ab12cd34-ef56-7890-ab12-cd34ef567890/messages \
-H "x-api-key: homie_sk_live_8f3a..." \
-H "Content-Type: application/json" \
-d '{
"message": "Do you have a waterproof jacket in blue?",
"currentUrl": "https://shop.example.com/jackets"
}'
const chatId = "ab12cd34-ef56-7890-ab12-cd34ef567890";
const res = await fetch(
`https://api.yourhomie.ai/v1/chats/${chatId}/messages`,
{
method: "POST",
headers: {
"x-api-key": "homie_sk_live_8f3a...",
"Content-Type": "application/json",
},
body: JSON.stringify({
message: "Do you have a waterproof jacket in blue?",
currentUrl: "https://shop.example.com/jackets",
}),
},
);
const message = await res.json();
Erfolgreiche Response
{
"id": "9b8a7c6d-5e4f-4a3b-9c2d-1e0f2a3b4c5d",
"chatId": "ab12cd34-ef56-7890-ab12-cd34ef567890",
"type": "assistant",
"content": "Yes, here is a waterproof jacket available in blue.",
"suggestions": [
"What sizes are available?",
"Is it machine washable?"
],
"products": [
{
"gtin": "4006381333931",
"brand": "Acme",
"designation": "All-Weather Jacket",
"url": "https://shop.example.com/p/all-weather-jacket",
"image": "https://shop.example.com/img/all-weather-jacket.jpg",
"price": 129.99,
"currency": "EUR",
"availability": {
"status": "in_stock",
"quantity": 12
}
}
],
"createdAt": "2025-10-16T11:45:02.512Z"
}
Fehler-Response
{
"message": "Monthly message quota reached"
}
Autorisierungen
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.