Stato del bot su una conversazione
curl --request PATCH \
--url https://api.dentalspace.ai/v1/conversations/{id}/bot \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"state": "attivo"
}
'const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({state: 'attivo'})
};
fetch('https://api.dentalspace.ai/v1/conversations/{id}/bot', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.dentalspace.ai/v1/conversations/{id}/bot"
payload = { "state": "attivo" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text){
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"patientId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"leadId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"phone": "<string>",
"botState": "attivo",
"botPausedUntil": "<string>",
"optedOut": true,
"lastInboundAt": "<string>",
"lastOutboundAt": "<string>",
"lastActivityAt": "<string>",
"createdAt": "<string>",
"updatedAt": "<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>"
}
}Messaggi WhatsApp
Stato del bot su una conversazione
Scope: messages:write.
{ "state": "attivo" } lo riaccende; { "state": "in_pausa", "pausedUntil": "<istante futuro>" } lo mette in pausa fino a quell’istante (al massimo 7 giorni). Se una persona l’ha spento (allo_studio) si puo’ solo riaccendere, non mettere in pausa.
PATCH
/
conversations
/
{id}
/
bot
Stato del bot su una conversazione
curl --request PATCH \
--url https://api.dentalspace.ai/v1/conversations/{id}/bot \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"state": "attivo"
}
'const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({state: 'attivo'})
};
fetch('https://api.dentalspace.ai/v1/conversations/{id}/bot', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.dentalspace.ai/v1/conversations/{id}/bot"
payload = { "state": "attivo" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text){
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"patientId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"leadId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"phone": "<string>",
"botState": "attivo",
"botPausedUntil": "<string>",
"optedOut": true,
"lastInboundAt": "<string>",
"lastOutboundAt": "<string>",
"lastActivityAt": "<string>",
"createdAt": "<string>",
"updatedAt": "<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>"
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
L'ETag ricevuto: la modifica passa solo se nessuno ha cambiato la risorsa (altrimenti 409 conflict, details.reason = version_mismatch).
Path Parameters
Identificativo della risorsa.
Pattern:
^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$Body
application/json
- Option 1
- Option 2
Allowed value:
"attivo"Response
La conversazione con il bot nel nuovo stato.
Pattern:
^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$Pattern:
^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$Pattern:
^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$attivo = risponde; in_pausa = zitto fino a botPausedUntil; allo_studio = spento da una persona.
Available options:
attivo, in_pausa, allo_studio true = il paziente ha scritto STOP: non gli si mandano messaggi automatici.