Sending Messages to a Group


I have a few separate tables, one with contacts where each contact is assigned to a group say A, B, C.
I also have another list of messages which are sent to different combinations of people say a message is just sent to group A, another is sent to group B and C and so on.

How can I create a new table which lists all the messages to be sent? Essentially where each row has the contact details + message to be sent to them so I can link this to the Twilio integration to send out?