SMS Sending
To send SMS from Witime, use the following parameters.
EndPoint https://sms.witi.me/sms/send.aspx?chave=API_KEY
Method POST
Input JSON with a set of messages to be sent
Response JSON with the result of the sending scheduling
The API key can be found in the SMS > SMS Settings menu.
We accept requests in major formats such as Zenvia, Movile, Twilio, among others. See more at Input Formats.
CURL Example
curl --location 'https://sms.witi.me/sms/send.aspx?chave=API_KEY&type=short&to=%2B5511987654321&msg=test%2Bmessage'
Replace the API_KEY variable before making the CURL call.
To test other route(s), add the parameter &route=X to the CURL call. To view active routes, go to SMS Settings > Preferred Route.
Asynchronous SMS Sending
Asynchronous sending allows messages to be sent faster, just add the argument async=true to the endpoint:
EndPoint https://sms.witi.me/sms/send.aspx?chave=API_KEY&async=true
Save the Key returned by the API to check the status of the asynchronous batch later.
Input
Root Class
| Property | Content |
|---|---|
| tipo_envio | common | token | debug Default: common |
| referencia | Name of a send for reference, optional. |
| rota | Route used to send the SMS. If not informed, uses the default route. |
| mensagens | array of Messages |
Messages Class
| Property | Content |
|---|---|
| numero | Contains the destination number of the message to be sent, in the format Area Code + Number |
| mensagem | Message text |
| DataAgendamento | Date and time the message should be delivered. |
| Codigo_cliente | Custom code, free to fill. |
| template | Template code to be sent instead of the 'message' field. |
| TemplateWEBID | WebId of the template to be sent instead of the 'message' field. |
Input Example:
{
"tipo_envio": "common",
"reference": "api send",
//"rota": 99,
"mensagens": [
{
"numero": "11999999999",
"mensagem": "test message 1",
"DataAgendamento": "2020-07-26 14:30:00",
"Codigo_cliente": "0000001"
},
{
"numero": "11999999998",
"mensagem": "test message 2",
"DataAgendamento": "2020-07-26 14:30:00",
"Codigo_cliente": "0000002"
}
]
}
Don't forget to inform the desired route (commented in the code above). Or set the default route in the SMS Settings menu.
Input Example (template):
{
"tipo_envio": "common",
"referencia": "api send",
//"route": 99,
"mensagens": [
{
"template": 123,
"number": "11999999999"
},
{
"TemplateWEBID": "4095a269-5d88-4bbb-9ff4-db33404d4f52",
"number": "11999999998"
},
]
}
Output
The response will be a JSON with the following characteristics.
Root Class
| Property | Content |
|---|---|
| CodigoResultado | 0 (zero) If everything is correct other value if there is any error |
| Mensagem | Status description |
| Chave | Unique identification key for this sending batch. |
| Cobrado | true or false |
| ValorCobrado | Value charged for the sending |
Messages Class
| Property | Content |
|---|---|
| numero | Contains the destination number of the message to be sent, in the format Area Code + Number |
| Mensagem | Message text |
| UniqueID | Unique identification number for this individual message. |
| DataAgendamento | Date and time the message should be delivered. |
| Custo | Individual message cost |
| IdDisparo | If a "reference" value was provided, contains the unique reference number of the sending. |
| Situacao | Code according to the message status: 0 Waiting 1 ReadyToSend 2 SentToAPI3 Blocked8 BlockedHLR9 SendingError10 DeliveredConfirmation11 Replied 99 OtherErrors |
| MensagemSituacao | Descriptive message of the message status |
| Codigo_cliente | Code provided by the client. |
| Rota | Indicates the message's output route |
Output Example:
{
"Resultado": {
"CodigoResultado": 0,
"Mensagem": "Messages sent successfully",
"Chave": "154d1f4d-2856-4913-80f8-084b20f3e9de",
"Cobrado": true,
"ValorCobrado": 0.20
},
"Mensagens": [
{
"numero": "+5511987654321",
"mensagem": "test message 1",
"UniqueID": "31b2c48f-2ea9-4979-a9dd-cbfb927de18f",
"DataAgendamento": "2020-07-26 14:35:08",
"Custo": 0.1000,
"idDisparo": 25,
"Situacao": 1,
"MensagemSituacao": null,
"Codigo_cliente": "0000001",
"Rota": 99
},
{
"numero": "+5511987654321",
"mensagem": "test message 2",
"UniqueID": "f795a269-5d88-4bbb-9ff4-db33404d4f52",
"DataAgendamento": "2020-07-26 14:35:08",
"Custo": 0.1000,
"idDisparo": 26,
"Situacao": 1,
"MensagemSituacao": null,
"Codigo_cliente": "0000002",
"Rota": 99
}
],
"Saldo": 5310.94
}
SMS Status
Check asynchronous batch
Returns the status of the asynchronous batch.
EndPoint https://sms.witi.me/sms/consultalote.aspx?chave=API_KEY&batch=BATCH_KEY
Method GET
Response JSON with the status of the message(s)
Simple check
Returns the current status of the message according to the provided ID.
EndPoint https://sms.witi.me/sms/getstatus.aspx?chave=API_KEY&messageid=MESSAGE_ID
SMPP EndPoint https://sms.witi.me/sms/getstatus.aspx?chave=API_KEY&messageid=MESSAGE_ID&type=smpp
Method GET
Response JSON with the message status
Batch check
Returns the status according to the list of messages provided.
EndPoint https://sms.witi.me/sms/getstatus.aspx?chave=API_KEY
SMPP EndPoint https://sms.witi.me/sms/getstatus.aspx?chave=API_KEY&type=smpp
Method POST
Input JSON list with the message IDs
Response JSON with the status of the message(s)
Input example:
[
"c6f5fd19-124a-4035-983a-471e3c448183",
"2185b568-537c-4702-bc38-a29009aa91c7",
"f586866a-d16a-43c7-98ee-7b86421251d5"
]
SMPP input example:
[
"2145172767744231",
"3019283749203872",
"6018023984723650"
]
Response example:
{
"Resultado": {
"CodigoResultado": 0,
"Mensagem": "Data returned successfully, 3 records",
"Chave": "225f93c6-9a11-49ab-ad52-064cf509cae0",
"Cobrado": false,
"ValorCobrado": 0.0
},
"Mensagens": [
{
"IdEmpresa": 14274,
"IdCallback": 437526,
"Tipo": "DLR",
"IdMensagem": "c6f5fd19-124a-4035-983a-471e3c448183",
"Situacao": 10,
"IdRota": 0,
"IdDisparo": 9258,
"CodOper": 0,
"Mensagem": "By providing the token 488861 you confirm that you have read and agree...",
"Tag": null,
"Cliente_ref": "15||209||0",
"DataSituacao": "2021-11-11T16:01:56.86",
"DataDespacho": "2021-11-11T15:59:05.097",
"DataEntregue": "2021-11-11T16:01:56.923",
"DataResposta": "0001-01-01T00:00:00",
"Remote_Dlr_time": "2021-11-11T16:01:56.86",
"Remote_status": "4-DELIVERE",
"Callback_data_execucao": "2021-11-11T16:02:00",
"Callback_post_content": "[{\"Data\":\"2021-11-11T16:01:56.923\",\"Tipo\":\"DLR\",\"MensagemUniqueId\":\"c6f5fd19-124a-4035-983a-471e3c448183\",\"Situacao\":10,\"SituacaoDescricao\":\"Delivered\",\"Mensagem\":null,\"Cliente_ref\":\"15||209||0\"}]",
"Callback_return_content": "",
"Callback_url": "http://my-site.com/messages?id=1",
"Callback_return_code": 200,
"Callback_tempo_ms": 437
},
{
"IdEmpresa": 1,
"IdCallback": 0,
"Tipo": "DLR",
"IdMensagem": "2185b568-537c-4702-bc38-a29009aa91c7",
"Situacao": 10,
"IdRota": 0,
"IdDisparo": 0,
"CodOper": 55320,
"Mensagem": "Marcelo, thank you for talking to our agents.",
"Tag": null,
"Cliente_ref": "",
"DataSituacao": "2021-11-11T16:01:56.86",
"DataDespacho": "2021-11-11T15:59:18.24",
"DataEntregue": "2021-11-11T16:01:56.923",
"DataResposta": "0001-01-01T00:00:00",
"Remote_Dlr_time": "2021-11-11T16:01:56.86",
"Remote_status": "4-DELIVERE",
"Callback_data_execucao": "0001-01-01T00:00:00",
"Callback_post_content": "",
"Callback_return_content": "",
"Callback_url": "",
"Callback_return_code": 0,
"Callback_tempo_ms": 0
},
{
"IdEmpresa": 1,
"IdCallback": 0,
"Tipo": "DLR",
"IdMensagem": "f586866a-d16a-43c7-98ee-7b86421251d5",
"Situacao": 10,
"IdRota": 0,
"IdDisparo": 0,
"CodOper": 55320,
"Mensagem": "Jeferson, thank you for talking to our agents.",
"Tag": null,
"Cliente_ref": "",
"DataSituacao": "2021-11-11T16:01:56.86",
"DataDespacho": "2021-11-11T15:59:10.783",
"DataEntregue": "2021-11-11T16:01:56.923",
"DataResposta": "0001-01-01T00:00:00",
"Remote_Dlr_time": "2021-11-11T16:01:56.86",
"Remote_status": "4-DELIVERE",
"Callback_data_execucao": "0001-01-01T00:00:00",
"Callback_post_content": "",
"Callback_return_content": "",
"Callback_url": "",
"Callback_return_code": 0,
"Callback_tempo_ms": 0
}
],
"Saldo": 5310.94
}
Cancel SMS Sending
EndPoint https://sms.witi.me/sms/cancel.aspx?chave=API_KEY
Method POST
Input JSON with the list of IDs of the messages to be canceled
Response JSON with the result of the sending scheduling
Cancellation can be done up to 5 minutes before sending.
Input
[
"f586866a-d16a-43c7-98ee-7b86421251d5",
"c6f5fd19-124a-4035-983a-471e3c448183",
...
// maximum of 250 messages per request
]
Output
{
"Resultado": {
"CodigoResultado": 0,
"Mensagem": "Messages canceled successfully, 2 records",
"Chave": "325f93a6-9a12-49ab-ad52-064cf509cee0",
"Cobrado": false,
"ValorCobrado": 0.0
},
"Mensagens": [
...
]
}