MS Teams does not need any API Key or client ID to push messages in it. All it needs is the webhook URL of the channel you want to send messages to. That itself acts as the credential.

Similar to Discord, the credential for this provider needs to be stored in the subscriber entity.

Getting an MS Teams webhook URL

In order to get a webhook url linked to a specific channel, you should:

Click on the three dots button next to the channel name and select the ‘Connectors’ option.

Search for the ‘Incoming Webhook’ connector and click on ‘Configure’.

Set a name for the connector and click on the ‘Create’ button at the bottom.

A new URL will be generated (only for this channel). This is the credential URL you need.

Connecting our subscribers to MS Teams

The URL generated above will be the target channel of a subscriber that you want to integrate with. To make this connection, you have to:

  1. Copy the URL that you generated above
  2. Update the subscriber credentials with this URL using the MS Teams provider id. You can do this step by using the @novu/node library, as shown below:
import {
  Novu,
  ChatProviderIdEnum
} from '@novu/node';

const novu = new Novu("<NOVU_API_KEY>");

await novu.subscribers.setCredentials('subscriberId', ChatProviderIdEnum.MsTeams, {
  webhookUrl: "<WEBHOOK_URL>",
});

Checkout the API reference for more details.

  • subscriberId is a custom identifier used when identifying your users within the Novu platform.
  • providerId is a unique provider identifier. We recommend using our ChatProviderIdEnum to specify the provider.
  • The third parameter is the credentials object, in this case, we use the webhookUrl property to specify the MS Teams channel webhook URL or by calling the Update Subscriber Credentials endpoint on Novu API. Check endpoint details here.
  1. You are all set up and ready to send your first chat message via our @novu/node package or directly using the REST API.