Send SMS log details
Please make sure you have an API up and running, similar to the endpoint shown below where 'your-custom-url' is your company domain. Onoff suggest to add an api-key as described in Authorization.
POST https://<your-custom-url>/v1/onoff/sms
Request
Body example
{
"id": "12345",
"eventName": "SMS",
"onoffUserName": "John Doe",
"onoffUserEmail": "john.doe@example.com",
"onoffUserNumber": "1234567890",
"externalNumber": "0987654321",
"externalName": "John Smith",
"externalEmail": "smith@example.com",
"date": "2023-05-20T14:30:00Z",
"smsDirection": "SENT",
"body": "This is the body of the SMS"
}
Field explanation
id StringUnique id of the SMS log detailseventName StringThis is the type of the event sent. Currently, the only value is SMS for SMS detail logonoffUserName StringUsername of the onoff user who is involved in the callonoffUserEmail StringEmail of the onoff user who is involved in the callonoffUserNumber StringPhone number of the person who has Onoff accountexternalNumber StringPhone number of the second partyexternalName StringIf the second party is in the contacts of the onoff user, then the first and last name will be sent. Otherwise, will not be sentexternalEmail StringIf the second party is in the contacts of the onoff user, then the contact email will be sent. Otherwise, will not be sentdate DateDate when the SMS was sent or receivedsmsDirection StringDirection of the SMS. Only two possible values, SENT or RECEIVEDbody StringContent of the message
Response
An empty Json or String is fine for us. What is important is that the HTTP Status in the response is 200 OK.
Body example
{
}
Errors
If after onoff makes the request to your specific domain, we receive 4xx or 5xx HTTP Status in the response, we will retry 4 times more to deliver the event info. After the last attempt, we do not succeed in the delivery, onoff will discard the log meaning it will be lost.
Recommendations
-
Idempotency: We look forward for you to implement a webhook in idempotent manner to avoid duplications in your side. A better explanation about the concept of idempotency here. Just note that each event that we send you has an unique UUID so that you can verify if it was processed before or not.
-
Timeouts: We expect your service to handle requests properly. Our service make request with the following timeouts
- Connect timeout: 1000 ms
- Read timeout: 10000 ms