Programmatically create inbound webhook to Teams Channel?

Vikram_162 0 Reputation points
2024-07-08T13:26:55.7933333+00:00

I want my application to be able to post messages/notifications into external Teams channels.

So far I've only found the manual way to do this- making the user generate an incoming webhook URL through their personal Teams app. They would then have to submit the signed URL to our website/application so we can use it for future notifications

This is a poor and confusing user experience.

I know slack allows programmatic webhook generation based on documentation here:

https://api.slack.com/authentication/oauth-v2

https://api.slack.com/legacy/oauth#flow

Is there something I'm missing in the Microsoft Graph API docs? Maybe if I have a way for the user to sign in and grant temporary credentials/a bearer token to our website/application, I could then use the temporary permissions to call an API to create this same webhook and save it for future use? Or have the granted permissions stay permanent, and use a Graph API call to post messages in designated channels moving forward?

As of last year according to this stack overflow reply, programmatic creation of webhooks doesn't seem to be supported: https://stackoverflow.com/questions/76718712/is-there-a-way-to-have-zero-touch-install-for-ms-teams-connectors-into-channel

Is it possible to add this as a thing to work on, given that it would make Teams integrations so much smoother?

Other options I looked into:

Microsoft Teams Development
Microsoft Security Microsoft Graph
Microsoft Teams Microsoft Teams for business Other
{count} votes

1 answer

Sort by: Most helpful
  1. Meghana-MSFT 4,116 Reputation points Microsoft External Staff
    2024-07-09T08:02:53.5366667+00:00

    Vikram_162 - Currently we cannot create/configure incoming webhook programmatically. Also there is no Graph API available to create incoming webhook. A feature request idea has been submitted here https://feedbackportal.microsoft.com/feedback/idea/4cadb0f0-54e5-ee11-a73d-6045bd7a7839. You can upvote the idea.

    Also, as you mentioned correctly Graph API supports only delegated permissions for sending chat messages. Application permissions are for migrating messages, this is by design implementation.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.