'Microsoft Teams channel webhook URL format validation - any consistent pattern/documentation?

I'm building an app that allows the user to input a Teams channel webhook connector URL for notifications.

I want to be able to do some basic validation on the URL to maximize the chance that the user's input is valid.

From what I can see on the few M365 tenants I have access to, the webhook appears to be in the format of:

https://tenant-name.webhook.office.com/webhookb2/some-guid/IncomingWebhook/some-guid/some-guid

But I'm not sure if that'd be the case for all tenants, and I believe at some point Microsoft changed this format too, as I have seen this one before:

https://outlook.office.com/webhook/some-guid/IncomingWebhook/some-guid/some-guid

So I'd need to have all versions accounted for.

I can't seem to find any documentation on this. If by any chance someone has worked on this and can provide some info, it'd be greatly appreciated.



Solution 1:[1]

We have verified it now in our tenant and the Webhook URL is similar to the one which you have shared first:

https://tenant-name.webhook.office.com/webhookb2/some-guid/IncomingWebhook/some-guid/some-guid

So you can use this format.

Reference link: https://docs.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/add-incoming-webhook

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dharman