Microsoft Tech Community Live:  Microsoft Teams Edition
November 09, 2021, 08:00 AM - 12:00 PM (PST)

Create Channel Dynamically if any message gets in to Channel

%3CLINGO-SUB%20id%3D%22lingo-sub-1300603%22%20slang%3D%22en-US%22%3ECreate%20Channel%20Dynamically%20if%20any%20message%20gets%20in%20to%20Channel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1300603%22%20slang%3D%22en-US%22%3E%3CP%3EIs%20there%20any%20option%20in%20Teams%20where%20I%20can%20create%20a%20channel%20when%20any%20specific%20message%20gets%20in%20to%20channel%3F%3C%2FP%3E%3CP%3EExample%3A%3C%2FP%3E%3CP%3E1)%20Channel%26nbsp%3B%20receives%20the%20message%20like%20%22%20%3CU%3E%3CEM%3EThis%20is%20Teams%20Developer%2C%20And%20you%20are%20a%20good%20developer%3C%2FEM%3E%3C%2FU%3E%22%26nbsp%3B%3C%2FP%3E%3CP%3E2)%20Condition%3A%20If%20the%20message%20contains%20%3CU%3E%3CSTRONG%3ETeams%3CI%3E%26nbsp%3B%3C%2FI%3E%3C%2FSTRONG%3E%3C%2FU%3Ethen%20create%20new%20channel%20with%20the%20name%20%22Channel1204%22%20and%20Add%20the%20user%20User1%2C%20User2%2C%20User3.%3C%2FP%3E%3CP%3EI%20know%20that%20if%20channel%20is%20private%20then%20We%20can%20add%20the%20specific%20user%20in%20it%20and%20in%20case%20of%20public%20all%20Teams%20members%20inherited%20it.%3C%2FP%3E%3CP%3EAny%20relevant%20answer%20is%20appreciated.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENote%3A%20the%20message%20might%20receive%20from%20user%20or%20Via%20Incoming%20connector.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1300603%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EMicrosoft%20Teams%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1301394%22%20slang%3D%22en-US%22%3ERe%3A%20Create%20Channel%20Dynamically%20if%20any%20message%20gets%20in%20to%20Channel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1301394%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F561606%22%20target%3D%22_blank%22%3E%40NadirRiyani%3C%2FA%3E%26nbsp%3Bumm%2C%20why%3F%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYes%20the%20graph%20api%20could%20read%20messages%2C%20and%20could%20create%20channels%2C%20maybe%20write%20an%20Azure%20Function.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1301872%22%20slang%3D%22en-US%22%3ERe%3A%20Create%20Channel%20Dynamically%20if%20any%20message%20gets%20in%20to%20Channel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1301872%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F178440%22%20target%3D%22_blank%22%3E%40Steven%20Collier%3C%2FA%3E%26nbsp%3B%2C%20Please%20take%20a%20look%20at%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fgraph%2Fapi%2Fchannel-post%3Fview%3Dgraph-rest-1.0%26amp%3Btabs%3Dhttp%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3ECreate%20Channel%20using%20Graph%20API%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1309430%22%20slang%3D%22en-US%22%3ERe%3A%20Create%20Channel%20Dynamically%20if%20any%20message%20gets%20in%20to%20Channel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1309430%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F371090%22%20target%3D%22_blank%22%3E%40Trinetra-MSFT%3C%2FA%3E%26nbsp%3B%20Thank%20you%20for%20your%20response.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYes%2C%20I%20knew%20the%20Graph%20API%20is%20the%20option.%20Here%20two%20questions%20on%20it.%3C%2FP%3E%3CP%3E1)%26nbsp%3B%20Is%20it%20possible%20to%20create%20Channel%20without%20Authentication%20(i.e.%20AAD%20Token%20-%20using%20single%20Signon%20OR%20AAD%20Username%2FPassword)%3F%3C%2FP%3E%3CP%3E2)%26nbsp%3B%20Which%20event%20do%20you%20suggest%20in%20Bot%20framework%20which%20executes%20when%20any%20Message%20gets%20Into%20the%20channel%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1311640%22%20slang%3D%22en-US%22%3ERe%3A%20Create%20Channel%20Dynamically%20if%20any%20message%20gets%20in%20to%20Channel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1311640%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F561606%22%20target%3D%22_blank%22%3E%40NadirRiyani%3C%2FA%3E%26nbsp%3B%2C%3C%2FP%3E%0A%3CP%3E1.%20Creating%20a%20channel%20using%20Graph%20API%20requires%20Group.ReadWrite.All%20permissions%20consented%20by%20admin%2C%20If%20your%20access_token%20have%20these%20permission%2C%20i%20think%20you%20are%20good%20to%20call%20this%20API.%3C%2FP%3E%0A%3CP%3E2.%20Whenever%20a%20new%20message%20or%20post%20arrives%20in%20a%20channel%2C%20You%20can%20go%20with%20the%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fgraph%2Fapi%2Fresources%2Fwebhooks%3Fview%3Dgraph-rest-1.0%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3E%20change%20notification%20API%2C%3C%2FA%3E%20which%20are%20useful%20to%20read%20chatMessages%20in%20channel%20but%20for%20that%20You%20need%20to%20subscribe%20to%20the%20channel.%20and%20need%20some%20more%20permissions%20to%20work%20with%20these%20API.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Contributor

Is there any option in Teams where I can create a channel when any specific message gets in to channel?

Example:

1) Channel  receives the message like " This is Teams Developer, And you are a good developer

2) Condition: If the message contains Teams then create new channel with the name "Channel1204" and Add the user User1, User2, User3.

I know that if channel is private then We can add the specific user in it and in case of public all Teams members inherited it.

Any relevant answer is appreciated.

 

Note: the message might receive from user or Via Incoming connector.

 

 

4 Replies

@NadirRiyani umm, why?

 

Yes the graph api could read messages, and could create channels, maybe write an Azure Function.

@Trinetra-MSFT  Thank you for your response.

 

Yes, I knew the Graph API is the option. Here two questions on it.

1)  Is it possible to create Channel without Authentication (i.e. AAD Token - using single Signon OR AAD Username/Password)?

2)  Which event do you suggest in Bot framework which executes when any Message gets Into the channel?

@NadirRiyani ,

1. Creating a channel using Graph API requires Group.ReadWrite.All permissions consented by admin, If your access_token have these permission, i think you are good to call this API.

2. Whenever a new message or post arrives in a channel, You can go with the change notification API, which are useful to read chatMessages in channel but for that You need to subscribe to the channel. and need some more permissions to work with these API.