web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Import Teams message t...
Power Automate
Suggested Answer

Import Teams message to PowerAutomate and lookup

(1) ShareShare
ReportReport
Posted on by 22
I'm working on an integration, where I'm trying to connect a group chat in MS Teams with Excel.
It should work this way:
- Whenever someone sends a message (trigger point), the Power Automate trigger should search for the body of said message in column A from an Excel Table from our SharePoint and reply with a cell value from the same row, but different column (if it finds a result).
- I understand that there can be several types of messages, but my logic will be to lookup for only 13-digit numeric number and ignore the rest.
- I'm trying to use the trigger 'When a new message is added to a chat or channel.
 
- Once The 13-digit number is identified then lookup for same in excel and retrieve a value from same row but different column.
- Post the retrieved value back in the chat group. 

I just can't get it to return the exact message I send to the group.
I tried the 'Enter data from the previous step' button, but it is only letting me choose between:
• ⁠Message Conversation ID
• ⁠Message ID
• ⁠Message Link
None of them work. AIs aren't helping either...
Which expression should I use to define the message's body as input for the next action? If possible, at all.
I know it should be easier using a channel, but it would defeat the purpose of the automation.

Power Automate - Cloud
I have the same question (0)
  • Suggested answer
    Valantis Profile Picture
    6,735 on at
     
    The chat trigger doesn't give you the message body directly in dynamic content. You need one extra step.
    After the trigger, add a 'Get message details' action (Teams connector) and set Message ID to the Message ID from the trigger. Then the message text is available via this expression:
    body('Get_message_details')?['body']?['plainTextContent']
    For extracting the 13-digit number, add a Compose action with this expression:
    first(matches(body('Get_message_details')?['body']?['plainTextContent'], '\d{13}'))
     
    That returns the first 13-digit sequence found in the message, or null if there isn't one. Wrap the rest of your flow in a Condition checking that this Compose output is not empty before doing the Excel lookup.

    For the Excel lookup, use 'List rows present in a table' with a Filter Query on column A equals the Compose output, then grab the value from the first result row.
     

     

    Best regards,

    Valantis

     

    ✅ If this helped solve your issue, please Accept as Solution so others can find it quickly.

    ❤️ If it didn’t fully solve it but was still useful, please click “Yes” on “Was this reply helpful?” or leave a Like :).

    🏷️ For follow-ups  @Valantis.

    📝 https://valantisond365.com/

    💼 LinkedIn

    ▶️ YouTube

  • Suggested answer
    11manish Profile Picture
    3,333 on at
    The Teams message text is not directly available in dynamic content.
     
    Use this expression to get it in Microsoft Power Automate:
    • triggerOutputs()?['body/body/content']
    Extract the 13-digit number using:
    • match(triggerOutputs()?['body/body/content'], '\d{13}')
    Add a condition to check if a number exists, then:
    • Lookup the value in Excel (make sure the column is Text)
    • Return the corresponding value
    Finally, post the result back to Teams.
     
    The message body is hidden inside the trigger output, so you must use an expression to access it.
     
  • AC-23042034-0 Profile Picture
    22 on at
    For some reason match is not working in my workflow.
     
    Thankyou for your kind responses.
     
    Appreciate it.
  • Suggested answer
    AC-23042034-0 Profile Picture
    22 on at
    Woahhhh!!! It Finally worked out.. Did some twist and turns but fortunately it worked out.
     

    step-by-step breakdown of your workflow:

     

    1.Trigger: When a new message is added to a chat or channel

    • Listens for new messages in a specific Teams group chat.

    2.For Each: Loop through each message

    • Iterates over all new messages detected by the trigger.

    3.Get Message Details (inside For Each)

    • For each message, fetches detailed information including the message content.

    4.Compose_2

    • Extracts the plain text content from the message details using a coalesce function to handle different possible formats.

    5.Compose

    • Splits the extracted message content by spaces and selects the last word (assumed to be a tag number).

    6.Get a Row (Excel)

    • Searches an Excel table for a row where the "Tag Number" matches the last word from the message.

    7.Post Message in a Chat or Channel

    • Posts a message back to the Teams group chat, displaying the "Deposit Id" found in the Excel row.

    Each step is dependent on the previous one’s success, following the logical flow defined by the RunAfter property.

  • Suggested answer
    AC-23042034-0 Profile Picture
    22 on at
    Woahhhh!!! It Finally worked out.. Did some twist and turns but fortunately it worked out.
     

    step-by-step breakdown of your workflow:

     

    1.Trigger: When a new message is added to a chat or channel

    • Listens for new messages in a specific Teams group chat.

    2.For Each: Loop through each message

    • Iterates over all new messages detected by the trigger.

    3.Get Message Details (inside For Each)

    • For each message, fetches detailed information including the message content.

    4.Compose_2

    • Extracts the plain text content from the message details using a coalesce function to handle different possible formats.

    5.Compose

    • Splits the extracted message content by spaces and selects the last word (assumed to be a tag number).

    6.Get a Row (Excel)

    • Searches an Excel table for a row where the "Tag Number" matches the last word from the message.

    7.Post Message in a Chat or Channel

    • Posts a message back to the Teams group chat, displaying the "Deposit Id" found in the Excel row.

    Each step is dependent on the previous one’s success, following the logical flow defined by the RunAfter property.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 377

#2
11manish Profile Picture

11manish 279

#3
David_MA Profile Picture

David_MA 234 Super User 2026 Season 1

Last 30 days Overall leaderboard