Generic SMS - API response format

Status
Not open for further replies.

edgility

New User
Joined
Apr 24, 2024
Messages
6
Reaction score
2
Hi, we are setting up SMS with our platform for a customer, and we have follow the below guide:
https://www.3cx.com/docs/supported-sip-trunk-requirements

Sending SMS is working fine, however in the 3cx UI, the message gets a blue tick even if we do no indicate it as delivered.
Can you provide docs on the expected response format for the outbound message send response? We tried responding with the DLR event for sent (but not delivered) as well as just sending a response with an ID param, but both result in the blue ticket immediately.
1713921325241.png

As per the docs:
> The Provider should send incoming SMS/MMS messages and delivery receipts to 3CX Phone System in order to configure webhook using POST method.


We are looking to become a 3CX partner as well, so I guess we'll have to sort it before then.

Thanks,
Evan / Edgility
 
All this information is included in this section.
 
Hi Theo,

What I am looking for is the correct response format to reply with after a message is sent, so it is not marked as delivered before we send a delivery receipt. Ie, the response to the below request
1713933192008.png

I guess we need to make sure 3cx knows the message ID, so we we send the delivery receipt it can mark it as delivered/failed.
Currently sending any 200 response results in a blue tick like the message has been delivered, even if we do not send a DLR event.
 
The required fields are also specified in the guideline:

1713933754441.png
 
The documentation is a little confusing, because above that section is says
The following is an example of an SMS delivery report which is sent by 3CX Phone System to the Provider when the SMS message is delivered successfully:
Which seems to imply that this is what 3CX is sending, not what it's receiving. Either way, it's related to delivery receipts, I assume those posted back to the 3cx webhook. Can you confirm the api response should be the same format?

Can you show an example response to the send request that marks the message as sent, not delivered? We have tried all kinds of responses, but it always shows the delivered tick irrespective. The first one below would satisfy the screenshot in your last post, and the second matches the actual example in the docs where `to` is an array of objects
{
"data": {
"event_type": "message.sent",
"payload": {
"id": 23990,
"to": {
"status": "sent"
}
}
}
}

{
"data": {
"id": 23991,
"event_type": "message.sent",
"payload": {
"id": 23991,
"status": "sent",
"to": [
{
"phone_number": "+61413102669",
"status": "sent"
}
]
}
}
}
 
Webhook notifications
The Provider should send incoming SMS/MMS messages and delivery receipts to 3CX Phone System in order to configure webhook using POST method.


The following is an example of sending a new incoming SMS message:


{
"data": {

"event_type": "message.received",

"id": "b301ed3f-1490-491f-995f-6e64e69674d4",

"occurred_at": "2019-12-09T20:16:07.588+00:00",

"payload": {

"completed_at": null,

"cost": null,

"direction": "inbound",

"encoding": "GSM-7",

"errors": [],

"from": {

"carrier": "T-Mobile USA",

"line_type": "long_code",

"phone_number": "+1312500000",

"status": "webhook_delivered"

},

"id": "84cca175-9755-4859-b67f-4730d7f58aa3",

"media": [],

"messaging_profile_id": "740572b6-099c-44a1-89b9-6c92163bc68d",

"organization_id": "47a530f8-4362-4526-829b-bcee17fd9f7a",

"parts": 1,

"received_at": "2019-12-09T20:16:07.503+00:00",

"record_type": "message",

"sent_at": null,

"tags": [],

"text": "Hello from Generic!",

"to": [

{

"carrier": "Generic",

"line_type": "Wireless",

"phone_number": "+1773005000",

"status": "webhook_delivered"

}

],

"type": "SMS",

"valid_until": null,

"webhook_failover_url": null,

"webhook_url": "http://webhook.site/04bbd2e3-09b5-4c9e-95de-a1debeb9e675"

},

"record_type": "event"

},

"meta": {

"attempt": 1,

"delivered_to": "http://webhook.site/04bbd2e3-09b5-4c9e-95de-a1debeb9e675"

}

}


Providers may extend this message with other data if needed. However, these are the required fields to be specified:

data.id
data.event_type
data.payload.from.phone_number
data.payload.to.phone_number
data.payload.text
data.payload.received_at
Field ‘data.id’ is the Provider's message ID (internal). Fields ‘phone_number’, ‘from’ and ‘to’ are phone numbers in E.164 format.
 
I am aware of that, what I am asking is the response format of the API call that 3cx makes. Even if I just return a straight 200 response with any data, it is marked as delivered in 3cx (without sending any webhooks to 3cx).

For example, responding with no response content at all = grey non delivered tick
responding with dummy data `{data: {"a": "b"}}` results in delivered tick



1713948318680.png
1713948385181.png


Responding with just the ID also results in a delivered tick.
How can we return the ID to 3cx so it can identify the correct delivery receipt, but without it prematurely being marked as delivered?
 
One gray check is "sending".

One blue check is "sent".

TWO blue check is "delivered", but that hasn't worked for generic trunks ever since the introduction of the generic SMS API.

Therefore, your 200 response just marks it as sent. Not delivered.
 
  • Like
Reactions: TheodorosG_3CX
Ahh ok thanks. The inclusion of documentation of delivery receipts seemed to indicate that it was possible. All good.
 
  • Like
Reactions: Evolute IT
Ahh ok thanks. The inclusion of documentation of delivery receipts seemed to indicate that it was possible. All good.
It is supposed to be but for some reason it never worked for generic trunks. Since generic are not supported, there was never a fix.

We had this issue when we integrated our provider into the SMS cycle.

Supported trunks can do it.
 
Thanks again for the quick reply. We've got a few clients on 3cx so we will research being an official provider.
 
  • Like
Reactions: TheodorosG_3CX
  • Like
Reactions: Evolute IT
Status
Not open for further replies.

Forum statistics

Threads
112,065
Messages
590,584
Members
165,019
Latest member
rsaldin@advancedbrainspin