In this section, we present how to connect Microsoft Teams to MindsDB.

Microsoft Teams is the ultimate messaging app for your organization—a workspace for real-time collaboration and communication, meetings, file and app sharing, and even the occasional emoji! All in one place, all in the open, all accessible to everyone.

The Microsoft Temas handler allows you to send messages to a channel in Microsoft Teams via a webhook.

Connection

This handler was implemented using the pymsteams, which is the Python Wrapper Library to send requests to Microsoft Teams Webhooks.

The Microsoft Temas handler is initialized with a single parameter:

  • webhook_url is a webhook url for the Microsoft Teams channel to send messages to.

Read about creating an Incoming Webhook in Microsoft Teams here.

To connect to Microsoft Teams using MindsDB, the following CREATE DATABASE statement can be used:

CREATE DATABASE teams_datasource
WITH ENGINE = 'teams',
PARAMETERS = {
  "webhook_url": "https://..."
};

If you installed MindsDB locally via pip, you need to install all handler dependencies manually. To do so, go to the handler’s folder (mindsdb/integrations/handlers/ms_teams_handler) and run this command: pip install -r requirements.txt.

Usage

Now, you can send messages to the configured Microsoft Teams channel:

INSERT INTO teams_datasource.messages(title, text)
VALUES 
('Hello from MindsDB!', 'This is a test message from MindsDB.');

You can also send multiple messages at once:

INSERT INTO teams_datasource.messages(title, text)
VALUES 
('Hello from MindsDB!', 'This is a test message from MindsDB.'),
('Hello again!', 'This is another test message from MindsDB.');

you can use this handler to send outputs from models created in MinsDB as notifications to Microsoft Teams.