In the solution we built, incoming messages are added as comments to a chatter thread on a Case - using similar logic to you, we look for an existing SMS message within 24 hours, and if so, assume it is for that case, and add it to the SMS feed on that case. 2017 Learn how to send SMS text messages using just a few lines of Golang code and Twilio.
All you have to do is simply fill in the few fields in the MoEngage settings page, save and test it and you are good to go.