Skip to content

Instantly share code, notes, and snippets.

@KyMidd
Created July 24, 2025 15:34
Show Gist options
  • Select an option

  • Save KyMidd/78a6e3b3cb15fbd64a6fbd4612cc90fa to your computer and use it in GitHub Desktop.

Select an option

Save KyMidd/78a6e3b3cb15fbd64a6fbd4612cc90fa to your computer and use it in GitHub Desktop.
def get_teams_conversation_history(user_graph_auth_token, event_body):
#...
# Look at type of conversation and build URL to fetch messages
if conversation_type == "channel":
#...
# Read conversation ID, find the parent message ID of the conversaton "Post"/thread
try:
full_convo_id = event_body.get("conversation", {}).get("id", "")
parent_message_id = None
if ";messageid=" in full_convo_id:
parent_message_id = full_convo_id.split(";messageid=")[-1]
else:
raise Exception("❓ Could not extract root message ID from conversation ID")
except Exception as error:
print(f"🚫 Error extracting root message ID: {error}")
raise
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment