Discussions

Ask a Question
Back to All

SMS Message ID different for inbound from outbound for same message- how to match?

Less of a technical question, more of a best practice. I have just set up an SMS webhook where I'll be logging SMS messages. I have a both directions type event so that I can see messages going to and from external numbers.
The issue I have is with duplicate logging of internal messages. I get a webhook event when User A sends the message and another when User B receives it. Before I set things up, I saw that each message had an ID, which led me to believe that I could use this to identify unique messages and avoid duplicate entries into the database. Unfortunately the same message has a different ID when it's sent to when it's received.
Obviously the situation get's worse when it's a group message.
What's the suggested approach to matching an outbound webhook SMS message event with the inbound event for the same message when there's no matching ID?
Is it to match the sender ID and message text in last 5 seconds?