Message AI Agent
Last updated
import requests
# API végpont
url = "https://admin.gpt4business.ai/en/chatbot/api/v1/message/"
# Kérés fejlécek
headers = {
'Authorization': 'Token <YOUR-API-TOKEN>',
'Content-Type': 'application/json'
}
# Kérés törzs adat
data = {
"chatbot_uuid": "12345678-1234-5678-1234-567812345678",
"query": "Your message/string here.",
"user_key": "Your message/string here."
}
# API kérés küldése
response = requests.post(url, headers=headers, json=data)
# Válasz ellenőrzése
if response.status_code == 200:
print("Válasz:", response.json().get('data'))
else:
error_data = response.json()
print("Hiba:", error_data.get('message', '') + error_data.get('error', '')){
"message": "AI Agent successfully answered.",
"data": {
"answer": "If you have a specific question or need assistance with something, please let me know and I`ll be happy to help.",
"chat_id": 634
}
}{
"detail": "Authentication credentials were not provided."
}{
"message": "The provided parameters are not valid. Please check and try again.",
"errors": {
"chatbot_uuid": [
"This field is required."
]
}
}