Home

Microsoft Teams API to post a message in a channel on behalf of the Application

%3CLINGO-SUB%20id%3D%22lingo-sub-993109%22%20slang%3D%22en-US%22%3EMicrosoft%20Teams%20API%20to%20post%20a%20message%20in%20a%20channel%20on%20behalf%20of%20the%20Application%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-993109%22%20slang%3D%22en-US%22%3E%3CP%3EHello%20everyone%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20new%20to%20Graph%20APIs%20and%20this%20might%20be%20a%20stupid%20question%20to%20ask%20but%20we%20have%20a%20requirement%20displaying%20all%20the%20channel%20names%20in%20a%20dropdown%20in%20a%20group%20and%20then%20when%20user%20selected%20a%20channel%20based%20on%20a%20button%20click%20we%20need%20to%20post%20some%20information%20about%20our%20app%20in%20the%20Teams%20channel%20user%20selected.%20Now%20to%20make%20is%20seamless%20we%20want%20to%20try%20it%20without%20making%20a%20user%20sign%20in%20so%20they%20don't%20have%20to%20sign%20in%20every-time.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20checked%20the%20Graph%20APIs%20but%20ChannelMessage%20does%20not%20let%20you%20SEND%20a%20message%20to%20a%20channel%20without%20signed%20in%20user.%20Is%20there%20a%20way%20we%20can%20achieve%20this%20without%20asking%20user%20to%20sign%20in%3F%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAlso%20I%20see%20the%20application%20level%20permission%20have%20something%20called%20%22Chat.ReadWriteAll%22%2C%20is%20it%20something%20we%20can%20utilize%3F%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAny%20help%20is%20deeply%20appreciated.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%2C%3C%2FP%3E%3CP%3EAkshat%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-993109%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAdministrator%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EBest%20Practices%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EChat%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EConversations%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMicrosoft%20Teams%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EUser%20Interface%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-993395%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20Teams%20API%20to%20post%20a%20message%20in%20a%20channel%20on%20behalf%20of%20the%20Application%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-993395%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F450481%22%20target%3D%22_blank%22%3E%40AkshatGandhi%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20would%20think%20that%20the%20API%20would%20have%20to%20have%20user%20context%20to%20be%20able%20to%20verify%20permissions%20to%20post%20as%20well%20as%20create%20the%20post%20with%20the%20correct%20user%20identity%20for%20other%20users%20to%20see.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIf%20your%20goal%20is%20to%20avoid%20the%20person%20using%20the%20app%20having%20to%20sign%20in%2C%20then%20you'd%20likely%20have%20use%20an%20internal%20user%20whose%20purpose%20was%20to%20post%20such%20%22public%22%20messages.%20Still%20would%20be%20a%20user%2C%20but%20one%20used%20by%20the%20app%20itself%2C%20not%20the%20person%20whose%20fingers%20were%20on%20the%20device.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Occasional Visitor

Hello everyone,

 

I am new to Graph APIs and this might be a stupid question to ask but we have a requirement displaying all the channel names in a dropdown in a group and then when user selected a channel based on a button click we need to post some information about our app in the Teams channel user selected. Now to make is seamless we want to try it without making a user sign in so they don't have to sign in every-time. 

 

I checked the Graph APIs but ChannelMessage does not let you SEND a message to a channel without signed in user. Is there a way we can achieve this without asking user to sign in? 

 

Also I see the application level permission have something called "Chat.ReadWriteAll", is it something we can utilize? 

 

Any help is deeply appreciated.

 

Thanks,

Akshat

1 Reply
Highlighted

@AkshatGandhi 

 

I would think that the API would have to have user context to be able to verify permissions to post as well as create the post with the correct user identity for other users to see. 

 

If your goal is to avoid the person using the app having to sign in, then you'd likely have use an internal user whose purpose was to post such "public" messages. Still would be a user, but one used by the app itself, not the person whose fingers were on the device.