cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Getting channel ID for channels in Teams

Hi I am trying to Post  A Message in a (MS Teams) Team, when a file is posted in a specific Channel.

 

The Team has multiple Channels so I am using the following Substing Function that extracts the Channel Id from the file path:

substring(triggerBody()?['{Path}'],17,sub(sub(length(triggerBody()?['{Path}']),1),17))

 

 

The Flow does not run the Post to Teams Section

The error message is as follows:

{
"error": {
"code": "InvalidRequest",
"message": "Channel id is not in a valid format: SBHI - Coffee Garden",
"innerError": {
"request-id": "29db7621-484a-4f78-a7a7-f35a921522b1",
"date": "2019-01-02T03:10:34"
 
 
Please Help
2 ACCEPTED SOLUTIONS

Accepted Solutions
v-yamao-msft
Community Support
Community Support

Hi @Anonymous,

 

Could you share a screenshot of your flow?

The error message says that the channel id is not in a valid format, I assume that it requires a GUID but not a text name.

I have made following flow for your reference.

Add the trigger When a file is created or modified (properties only) to get the folder path.

Add a Compose action to get the specific channel name:

substring(triggerBody()?['{Path}'],0,sub(length(triggerBody()?['{Path}']),9))

Then list channels from a team.

Add a Condition to check if the Compose output equals to the Channel name.

Under if yes branch, add action Post message. Select dynamic content Channel Id from the previous action.

1.PNG2.PNG 

 

Best regards,

Mabel

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Anonymous
Not applicable

AWESOME Thank You it is Working Perfectly now thanks

 

FYI,

 

Your Compose substring was incorrect, so I used the following:

 

substring(triggerBody()?['{Path}'],17,sub(length(triggerBody()?['{Path}']),18))
 
where the substring of the paths starting position of 17 characters is after the "SHARED DOCUMENTS/", and then for the amount of characters is 18 which is the subtraction from the length (which is the 17 from the start plus the final "/" at the end).
 
Cheers,
 
 

View solution in original post

3 REPLIES 3
v-yamao-msft
Community Support
Community Support

Hi @Anonymous,

 

Could you share a screenshot of your flow?

The error message says that the channel id is not in a valid format, I assume that it requires a GUID but not a text name.

I have made following flow for your reference.

Add the trigger When a file is created or modified (properties only) to get the folder path.

Add a Compose action to get the specific channel name:

substring(triggerBody()?['{Path}'],0,sub(length(triggerBody()?['{Path}']),9))

Then list channels from a team.

Add a Condition to check if the Compose output equals to the Channel name.

Under if yes branch, add action Post message. Select dynamic content Channel Id from the previous action.

1.PNG2.PNG 

 

Best regards,

Mabel

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

AWESOME Thank You it is Working Perfectly now thanks

 

FYI,

 

Your Compose substring was incorrect, so I used the following:

 

substring(triggerBody()?['{Path}'],17,sub(length(triggerBody()?['{Path}']),18))
 
where the substring of the paths starting position of 17 characters is after the "SHARED DOCUMENTS/", and then for the amount of characters is 18 which is the subtraction from the length (which is the 17 from the start plus the final "/" at the end).
 
Cheers,
 
 

I am bumbling through trying to send a message to a team via a flow using the information from the 'Get Channel Link'.  Am I correct in thinking that using the substring command you have listed there I can derive the channel correctly to then send a message to that particular channel - mention the channel.  Basically I have a flow that when a message is received in a channel it triggers a flow to send a message to engineers in another channel.  There are about 6 different recipient channels and if I can get this to work for one I will have the ability to have these notifications going all over the place..  perfect for our WFH world.

Helpful resources

Announcements
MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power automate tips 768x460 v2.png

Restore a Deleted Flow

Did you know that you could restore a deleted flow? Check out this helpful article.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Users online (2,296)