Background: I have been working with twitter API. Have it setup so that when someone mentions/messages me, it gets sent to a chatbot. Bot make reply, I tweet it out using API.
Each tweet has a unique status_id
in addition to a field called rep_to_stat_id
so a conversation looks like this:
person 'hi how are you?' stat_id = 1 rep_to_stat_id = blank
me 'ok, and you?' stat_id = 2 rep_to_stat_id = 1
person 'are you stalking me' stat_id = 3 rep_to_stat_id = 2
me 'no you are stalking me' stat_id = 4 rep_to_stat_id = 3
etc.
When I send to bot first time, make a random converstation ID (conv_id
) so the bot can track the conversation.
Problem is tracking this, it's like a ladder, leading up to the original stat_id
with no rep_to_stat_id
, and has to include the common conv_id
.
Up until now I have always had tables with a one to many type setup, I cannot get my head around what type of structure this is.
Is there an option in mysql to add to query to follow a ladder of each conversation to its first/last point?