Contact Center AI Platform (CCAI Platform) fornisce l'endpoint SMS in uscita per il canale SMS.
SMS in uscita
| Parametro | Obbligatorio | Tipo di dati | Definizione | |
|---|---|---|---|---|
| chat_type | VERO | Stringa | Tipo di chat da creare. "Messaggistica (API)" e "SMS" (ritirato) sono disponibili per il momento | Messaggistica (API) |
| end_user_number | VERO | Stringa | Numero a cui inviare l'SMS | `{end_user_number}` |
| outbound_number | VERO | Stringa | Numero di telefono in uscita da utilizzare per l'invio del messaggio SMS | `{outbound_number}` |
| messaggio | VERO | Stringa | Messaggio SMS da inviare al consumatore | `{message}` |
| ticket_id | FALSE | Stringa | L'ID ticket CRM che verrà associato alla sessione | `{ticket_id}` |
Endpoint:
Method: POST
Type: RAW
URL: https://{{subdomain}}.{{domain}}/apps/api/v1/sms
Intestazioni:
| Chiave | Valore | Descrizione |
|---|---|---|
| Content-Type | application/json |
Corpo:
{
"chat_type": "Messaging (SMS)",
"end_user_number": "+1 415-555-0100",
"outbound_number": "+1 628-555-0199",
"message": "lorem ipsum",
"ticket_id": "5006x00000XXxxxXXX"
}
Esempi di richieste e risposte
Le sezioni seguenti forniscono richieste di esempio all'endpoint.
Creare una chat SMS in uscita con l'ID ticket
Questo esempio mostra come creare un SMS in uscita per un utente finale associato a un ID ticket.
Richiesta
Intestazioni:
| Chiave | Valore | Descrizione |
|---|---|---|
| Content-Type | application/json |
Corpo:
{
"chat_type": "Messaging (SMS)",
"end_user_number": "+1 415-555-0100",
"outbound_number": "+1 628-555-0199",
"message": "lorem ipsum",
"ticket_id": "5006x00000XXxxxXXX"
}
Risposta: crea una chat SMS in uscita con ticket_id
{
"id": 114,
"lang": "en",
"chat_type": "Messaging (SMS)",
"status": "selecting",
"created_at": "2021-10-04T17:20:51.000Z",
"queued_at": null,
"assigned_at": null,
"ends_at": null,
"wait_duration": 0,
"chat_duration": 0,
"rating": null,
"has_feedback": false,
"out_ticket_id": null,
"out_ticket_url": null,
"verified": false,
"disconnected_by": "disconnected_by_unknown",
"fail_reason": null,
"selected_menu": null,
"menu_path": null,
"agent_info": null,
"end_user": {
"id": 87,
"identifier": null,
"out_contact_id": null
},
"photos": [],
"videos": [],
"transfers": [],
"participants": [
{
"id": 205,
"type": "end_user",
"status": "connected",
"chat_id": 114,
"user_id": null,
"end_user_id": 87,
"chat_duration": null,
"connected_at": "2021-10-04T17:20:51.000Z",
"ended_at": null,
"fail_reason": "nothing"
}
],
"offer_type": null,
"offer_events": [],
"answer_type": "manual",
"outbound_number": "+16285550199"
}
Codice di stato: 200
Crea una chat SMS in uscita e assegnala a un agente utilizzando l'ID agente
Questo esempio mostra come creare un SMS in uscita assegnato a un agente in base all'ID agente fornito.
Richiesta
Intestazioni:
| Chiave | Valore | Descrizione |
|---|---|---|
| Content-Type | application/json |
Corpo:
{
"chat_type": "Messaging (SMS)",
"end_user_number": "+1 415-555-0100",
"outbound_number": "+1 628-555-0199",
"message": "lorem ipsum",
"agentId": 1
}
Risposta: crea una chat SMS in uscita e assegnala a un agente utilizzando agentId
{
"id": 114,
"lang": "en",
"chat_type": "Messaging (SMS)",
"status": "assigned",
"created_at": "2021-10-04T17:20:51.000Z",
"queued_at": null,
"assigned_at": "2021-10-04T17:20:53.000Z",
"ends_at": null,
"wait_duration": 0,
"chat_duration": 0,
"rating": null,
"has_feedback": false,
"out_ticket_id": null,
"out_ticket_url": null,
"verified": false,
"disconnected_by": "disconnected_by_unknown",
"fail_reason": null,
"selected_menu": null,
"menu_path": null,
"agent_info": {
"id": 1,
"agent_number": 9,
"email": "john.doe@foo.com",
"name": "John Doe",
"first_name": "John",
"last_name": "Doe",
"avatar_url": "https://foobar.com/johndoe"
},
"end_user": {
"id": 87,
"identifier": null,
"out_contact_id": null
},
"photos": [],
"videos": [],
"transfers": [],
"participants": [
{
"id": 205,
"type": "end_user",
"status": "connected",
"chat_id": 114,
"user_id": null,
"end_user_id": 87,
"chat_duration": null,
"connected_at": "2021-10-04T17:20:51.000Z",
"ended_at": null,
"fail_reason": "nothing"
},
{
"id": 206,
"type": "agent",
"status": "connected",
"chat_id": 114,
"user_id": 1,
"end_user_id": null,
"chat_duration": null,
"connected_at": "2021-10-04T17:20:53.000Z",
"ended_at": null,
"fail_reason": "nothing"
}
],
"offer_type": null,
"offer_events": [],
"answer_type": "manual",
"outbound_number": "+16285550199"
}
Codice di stato: 200
Crea una chat SMS in uscita e assegnala all'email di un agente
Questo esempio mostra come creare una sessione di chat SMS in uscita e associarla a un agente in base all'indirizzo email dell'agente.
Richiesta
Intestazioni:
| Chiave | Valore | Descrizione |
|---|---|---|
| Content-Type | application/json |
Corpo:
{
"chat_type": "Messaging (SMS)",
"end_user_number": "+1 415-555-0100",
"outbound_number": "+1 628-555-0199",
"message": "lorem ipsum",
"agentEmail": "john.doe@foo.com"
}
Risposta: crea una chat SMS in uscita e assegnala a un agente utilizzando agentId
{
"id": 114,
"lang": "en",
"chat_type": "Messaging (SMS)",
"status": "assigned",
"created_at": "2021-10-04T17:20:51.000Z",
"queued_at": null,
"assigned_at": "2021-10-04T17:20:53.000Z",
"ends_at": null,
"wait_duration": 0,
"chat_duration": 0,
"rating": null,
"has_feedback": false,
"out_ticket_id": null,
"out_ticket_url": null,
"verified": false,
"disconnected_by": "disconnected_by_unknown",
"fail_reason": null,
"selected_menu": null,
"menu_path": null,
"agent_info": null,
"end_user": {
"id": 87,
"identifier": null,
"out_contact_id": null
},
"photos": [],
"videos": [],
"transfers": [],
"participants": [
{
"id": 205,
"type": "end_user",
"status": "connected",
"chat_id": 114,
"user_id": null,
"end_user_id": 87,
"chat_duration": null,
"connected_at": "2021-10-04T17:20:51.000Z",
"ended_at": null,
"fail_reason": "nothing"
},
{
"id": 206,
"type": "agent",
"status": "connected",
"chat_id": 114,
"user_id": 1,
"end_user_id": null,
"chat_duration": null,
"connected_at": "2021-10-04T17:20:53.000Z",
"ended_at": null,
"fail_reason": "nothing"
}
],
"offer_type": null,
"offer_events": [],
"answer_type": "manual",
"outbound_number": "+16285550199"
}
Codice di stato: 200
Crea una chat SMS in uscita senza ID ticket
Questo esempio mostra come creare un SMS in uscita senza associarlo a un ID ticket.
Richiesta
Intestazioni:
| Chiave | Valore | Descrizione |
|---|---|---|
| Content-Type | application/json |
Corpo:
{
"chat_type": "Messaging (SMS)",
"end_user_number": "+1 415-555-0100",
"outbound_number": "+1 628-555-0199",
"message": "lorem ipsum",
"ticket_id": "5006x00000XXxxxXXX"
}
Risposta: crea una chat SMS in uscita senza ticket_id
{
"id": 114,
"lang": "en",
"chat_type": "Messaging (SMS)",
"status": "selecting",
"created_at": "2021-10-04T17:20:51.000Z",
"queued_at": null,
"assigned_at": null,
"ends_at": null,
"wait_duration": 0,
"chat_duration": 0,
"rating": null,
"has_feedback": false,
"out_ticket_id": null,
"out_ticket_url": null,
"verified": false,
"disconnected_by": "disconnected_by_unknown",
"fail_reason": null,
"selected_menu": null,
"menu_path": null,
"agent_info": null,
"end_user": {
"id": 87,
"identifier": null,
"out_contact_id": null
},
"photos": [],
"videos": [],
"transfers": [],
"participants": [
{
"id": 205,
"type": "end_user",
"status": "connected",
"chat_id": 114,
"user_id": null,
"end_user_id": 87,
"chat_duration": null,
"connected_at": "2021-10-04T17:20:51.000Z",
"ended_at": null,
"fail_reason": "nothing"
}
],
"offer_type": null,
"offer_events": [],
"answer_type": "manual",
"outbound_number": "+16285550199"
}
Codice di stato: 200
Errore : è necessario fornire chat_type
Questo esempio mostra lo scenario di errore in cui "chat_type" non è stato fornito, ma è obbligatorio.
Richiesta
Intestazioni:
| Chiave | Valore | Descrizione |
|---|---|---|
| Content-Type | application/json |
Corpo:
{
"end_user_number": "+1 415-555-0100",
"outbound_number": "+1 628-555-0199",
"message": "lorem ipsum",
"ticket_id": "5006x00000XXxxxXXX"
}
Risposta: Errore : è necessario fornire chat_type
{
"message": "chat_type needs to be provided"
}
Codice di stato: 400
Errore : è necessario fornire un tipo di chat valido
Questo esempio mostra lo scenario di errore in cui il tipo di chat deve essere fornito, ma non era presente.
Richiesta
Intestazioni:
| Chiave | Valore | Descrizione |
|---|---|---|
| Content-Type | application/json |
Corpo:
{
"chat_type": "In-app",
"end_user_number": "+1 415-555-0100",
"outbound_number": "+1 628-555-0199",
"message": "lorem ipsum",
"ticket_id": "5006x00000XXxxxXXX"
}
Risposta: Errore : è necessario fornire un tipo di chat valido
{
"message": "valid chat type needs to be provided"
}
Codice di stato: 400
Errore : gli SMS non sono attivi
Questo esempio mostra lo scenario di errore in cui viene avviato un SMS in uscita, ma gli SMS non sono abilitati.
Richiesta
Intestazioni:
| Chiave | Valore | Descrizione |
|---|---|---|
| Content-Type | application/json |
Corpo:
{
"chat_type": "Messaging (SMS)",
"end_user_number": "+1 415-555-0100",
"outbound_number": "+1 628-555-0199",
"message": "lorem ipsum",
"ticket_id": "5006x00000XXxxxXXX"
}
Risposta: Errore : gli SMS non sono attivati
{
"message": "SMS is not enabled"
}
Codice di stato: 400
Errore : gli SMS in uscita non sono attivi
Questo esempio mostra lo scenario di errore in cui viene avviata una sessione SMS, ma non va a buon fine perché il canale SMS non è abilitato.
Richiesta
Intestazioni:
| Chiave | Valore | Descrizione |
|---|---|---|
| Content-Type | application/json |
Corpo:
{
"chat_type": "Messaging (SMS)",
"end_user_number": "+1 415-555-0100",
"outbound_number": "+1 628-555-0199",
"message": "lorem ipsum",
"ticket_id": "5006x00000XXxxxXXX"
}
Risposta: Errore : gli SMS in uscita non sono attivi
{
"message": "Outbound SMS is not enabled"
}
Codice di stato: 400
Errore : il numero dell'utente finale è obbligatorio
Questo esempio mostra lo scenario di errore in cui il numero dell'utente finale non è stato fornito, ma è obbligatorio.
Richiesta
Intestazioni:
| Chiave | Valore | Descrizione |
|---|---|---|
| Content-Type | application/json |
Corpo:
{
"chat_type": "Messaging (SMS)",
"outbound_number": "+1 628-555-0199",
"message": "lorem ipsum",
"ticket_id": "5006x00000XXxxxXXX"
}
Risposta: Errore : end_user_number è obbligatorio
{
"message": "end_user_number is required"
}
Codice di stato: 400
Errore : il numero dell'utente finale non è valido
Questo esempio mostra lo scenario di errore in cui il numero dell'utente finale fornito non è valido.
Richiesta
Intestazioni:
| Chiave | Valore | Descrizione |
|---|---|---|
| Content-Type | application/json |
Corpo:
{
"chat_type": "Messaging (SMS)",
"end_user_number": "12345",
"outbound_number": "+1 628-555-0199",
"message": "lorem ipsum",
"ticket_id": "5006x00000XXxxxXXX"
}
Risposta: Errore : end_user_number non è valido
{
"message": "end_user_number is invalid"
}
Codice di stato: 400
Errore : numero di telefono non statunitense non consentito
Questo esempio mostra lo scenario di errore in cui il numero fornito non è un numero di telefono statunitense ed è vietato.
Richiesta
Intestazioni:
| Chiave | Valore | Descrizione |
|---|---|---|
| Content-Type | application/json |
Corpo:
{
"chat_type": "Messaging (SMS)",
"end_user_number": "+1 415-555-0100",
"outbound_number": "+82 000-000-0000",
"message": "lorem ipsum",
"ticket_id": "5006x00000XXxxxXXX"
}
Risposta: Errore : numero di telefono non statunitense non consentito
{
"message": "Non-US phone number not allowed"
}
Codice di stato: 400
Errore : il numero in uscita è obbligatorio
Questo esempio mostra lo scenario di errore in cui il numero in uscita non è stato fornito, ma è obbligatorio.
Richiesta
Intestazioni:
| Chiave | Valore | Descrizione |
|---|---|---|
| Content-Type | application/json |
Corpo:
{
"chat_type": "Messaging (SMS)",
"end_user_number": "+1 415-555-0100",
"message": "lorem ipsum",
"ticket_id": "5006x00000XXxxxXXX"
}
Risposta: Errore : outbound_number è obbligatorio
{
"message": "outbound_number is required"
}
Codice di stato: 400
Errore : il numero in uscita non è valido
Questo esempio mostra lo scenario di errore in cui il numero in uscita fornito non è valido.
Richiesta
Intestazioni:
| Chiave | Valore | Descrizione |
|---|---|---|
| Content-Type | application/json |
Corpo:
{
"chat_type": "Messaging (SMS)",
"end_user_number": "+1 415-555-0100",
"outbound_number": "12345",
"message": "lorem ipsum",
"ticket_id": "5006x00000XXxxxXXX"
}
Risposta: Errore : outbound_number non è valido
{
"message": "outbound_number is invalid"
}
Codice di stato: 400
Errore : outbound_number non trovato
Intestazioni:
| Chiave | Valore | Descrizione |
|---|---|---|
| Content-Type | application/json |
Corpo:
{
"chat_type": "Messaging (SMS)",
"end_user_number": "+1 415-555-0100",
"outbound_number": "+1 628-555-0199",
"message": "lorem ipsum",
"ticket_id": "5006x00000XXxxxXXX"
}
Risposta: Errore : outbound_number non trovato
{
"message": "outbound_number is not found"
}
Codice di stato: 400
Errore : il messaggio è obbligatorio
Questo esempio mostra lo scenario di errore in cui il messaggio non è stato fornito in requires, ma è obbligatorio.
Richiesta
Intestazioni:
| Chiave | Valore | Descrizione |
|---|---|---|
| Content-Type | application/json |
Corpo:
{
"chat_type": "Messaging (SMS)",
"end_user_number": "+1 415-555-0100",
"outbound_number": "+1 628-555-0199",
"message": "",
"ticket_id": "5006x00000XXxxxXXX"
}
Risposta: Errore : il messaggio è obbligatorio
{
"message": "message is required"
}
Codice di stato: 400
Errore : SMS in uscita non riuscito. Il consumatore si trova già in una sessione SMS attiva.
Intestazioni:
| Chiave | Valore | Descrizione |
|---|---|---|
| Content-Type | application/json |
Corpo:
{
"chat_type": "Messaging (SMS)",
"end_user_number": "+1 415-555-0100",
"outbound_number": "+1 628-555-0199",
"message": "lorem ipsum",
"ticket_id": "5006x00000XXxxxXXX"
}
Risposta: Errore : SMS in uscita non riuscito. Il consumatore si trova già in una sessione SMS attiva.
{
"message": "Outbound SMS failed. Consumer is already in an active SMS session."
}
Codice di stato: 400