0
votes

I am moving some integrations that use webhooks from Slack to MS Teams. Slack has a convenient way of overriding the channel name that the message gets posted to in the webhook payload. MS Teams appears to generate a unique webhook URL per channel.

I'm therefore looking for a way to enumerate the list of channels in a given 'Team' and retrieve the 'incoming-webhook' Connector url for each.

I cannot find a way to do this.

2

2 Answers

0
votes

You should do some API calls to infer that.

First, you should get all teams in your organization. Do to that you should call:

GET /groups?$select=id,resourceProvisioningOptions

Or:

GET /groups?$filter=resourceProvisioningOptions/Any(x:x eq 'Team')

You can read more about it at List all teams in Microsoft Teams for an organization. The response will be of the form:

HTTP/1.1 200 OK
Content-type: application/json
Content-length: xxx

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#groups",
    "value": [
        {
            "id": "00e897b1-70ba-4cb9-9126-fd5f95c4bb78",
            "resourceProvisioningOptions": []
        },
        {
            "id": "00f6e045-f884-4359-a617-d459ee626862",
            "resourceProvisioningOptions": [
                "Team"
            ]
        }
    ]
}

Then, for each id in the response above, you should call to list channels:

GET /teams/{id}/channels

You can read more about this API at List Chanels. The response will have an entry in its json called webUrl. The value of that key, will be the channel URL you are looking for.

0
votes

You can get the list of channels in Team using List channels API but it is not possible to fetch the Webhook URL's added in each channel.