Fa una domanda alla chat
curl --request POST \
--url https://businessinsider.squaddcrm.com/api/v1/chat/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"text": "<string>",
"conversationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"wait": true
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
text: '<string>',
conversationId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
wait: true
})
};
fetch('https://businessinsider.squaddcrm.com/api/v1/chat/messages', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://businessinsider.squaddcrm.com/api/v1/chat/messages"
payload = {
"text": "<string>",
"conversationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"wait": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"conversationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"questionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"answerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"answer": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"role": "user",
"text": "<string>",
"status": "in-progress",
"error": "<string>",
"sources": "<unknown>",
"createdAt": "2023-11-07T05:31:56Z"
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"details": {},
"requestId": "<string>"
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"details": {},
"requestId": "<string>"
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"details": {},
"requestId": "<string>"
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"details": {},
"requestId": "<string>"
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"details": {},
"requestId": "<string>"
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"details": {},
"requestId": "<string>"
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"details": {},
"requestId": "<string>"
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"details": {},
"requestId": "<string>"
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"details": {},
"requestId": "<string>"
}
}Chat
Fa una domanda alla chat
Senza conversationId apre una conversazione nuova. Con wait: true aspetta la risposta fino a 40 secondi (200 con la risposta); altrimenti, o se la risposta va oltre, risponde 202: la risposta arriva con l’evento chat.answer.completed o rileggendo la conversazione. Ogni risposta scala il credito dell’organizzazione.
POST
/
chat
/
messages
Fa una domanda alla chat
curl --request POST \
--url https://businessinsider.squaddcrm.com/api/v1/chat/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"text": "<string>",
"conversationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"wait": true
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
text: '<string>',
conversationId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
wait: true
})
};
fetch('https://businessinsider.squaddcrm.com/api/v1/chat/messages', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://businessinsider.squaddcrm.com/api/v1/chat/messages"
payload = {
"text": "<string>",
"conversationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"wait": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"conversationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"questionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"answerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"answer": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"role": "user",
"text": "<string>",
"status": "in-progress",
"error": "<string>",
"sources": "<unknown>",
"createdAt": "2023-11-07T05:31:56Z"
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"details": {},
"requestId": "<string>"
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"details": {},
"requestId": "<string>"
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"details": {},
"requestId": "<string>"
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"details": {},
"requestId": "<string>"
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"details": {},
"requestId": "<string>"
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"details": {},
"requestId": "<string>"
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"details": {},
"requestId": "<string>"
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"details": {},
"requestId": "<string>"
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"details": {},
"requestId": "<string>"
}
}