With the /messages/sms API, how are you meant to determine which 'partial' messages to join together?
Consider example where the 1 phone number is sending 2 messages to your number - and each message is 2 SMS due to their length.
The API can give this, and they can be in random order:
...,"message":"pt1/2:<part of message>,"senderAddress":"MySenderID",...
...,"message":"pt1/2:<part of message>,"senderAddress":"MySenderID",..
...,"message":"pt2/2:<part of message>,"senderAddress":"MySenderID",..
...,"message":"pt2/2:<part of message>,"senderAddress":"MySenderID",...
For all 4 messages the 'apiMsgId' field is empty and the 'messageId' field is different for all 4.... so how do you know which pt2 matches to which pt1?
When using the
/messages/sms
API to receive multipart SMS messages, you can determine which partial messages belong to the same message by looking at themultipartRefId
field in the response.In your example, if the two messages from the same phone number were meant to be part of the same message, they should have the same
multipartRefId
. Therefore, you would need to check themultipartRefId
field of each partial message to determine which ones belong together. The partial messages with the samemultipartRefId
should be joined together in the order specified by thepartNumber
field.So, for example, if the first partial message has
multipartRefId
set to "abc" andpartNumber
set to "1", and the second partial message hasmultipartRefId
set to "abc" andpartNumber
set to "2", then you would know that these two partial messages belong to the same message and should be joined together in the order specified by thepartNumber
field.If the partial messages do not have a
multipartRefId
field, you could try using themessageId
field to group them together, assuming that the sender is correctly setting themessageId
field to the same value for all partial messages that belong to the same message.Source: SMSala Bulk SMS Service Provider