How to get your data from various services to MS Teams Channel


Home > Blogs > How to get your data from various services to MS Teams Channel

 
 

MS Teams allows users to create a webhook that allows users to post data into the channel.

The user can expose any HTTPS endpoint and design your own connectors. Microsoft has made an easy process to design the connector. You can make your life easy using a connector. It’s a simple way to get content from external sources to the Teams channel.

There are two ways you may create a connector. One inbuilt App is available in the store which you may use. And one you may design your own custom connector.

Microsoft gives the Javascript SDK to design the connector in easy form. You just need to inherit the SDK and create the connector by extending the javascript methods. The inbuilt method will give the unique Incoming webhook URL. This URL has a direct connection with your channel. Any engine can post the content to the channel using the Incoming webhook URL. Once the engine starts sending content to the channel, users will receive an alert in the channel.

Ofcourse, the user who creates the connector has the rights to discontinue the service, But until the user removes the connection the user will continue to receive a message from the configured sources.

In other words, we may say, it allows users to subscribe to receive notifications and messages from your web services. They expose an HTTPS endpoint for your service to post messages to the channel. Let’s review some code samples.

Initialize the Teams SDK

//Initialize the MS Teams library
microsoftTeams.initialize();

Get Incoming webhook URL

microsoftTeams.settings.getSettings(function (settings) {
$("#webhookUrl").val(settings.webhookUrl);
});

Set Incoming webhook URL

microsoftTeams.settings.registerOnSaveHandler(function (saveEvent) {
url = "https://" + window.location.hostname;
microsoftTeams.getContext(function (context) {
entity = ``connector-${context.teamId}-${context.channelId}`;
});

You may refer to more functions in Teams Javascript SDK here.

You may connect your Teams channel with any service outside the world. The service may be Twitter, Trello, Github, Azure or any custom applications.

POST your content to Channels

Teams accept standard format to receive content via Incoming webhooks. You can POST JSON payload as a message to the webhook URL. Teams connector supports Message card format.
Users may format the message card using Markdown format. You may find designing guidelines in Microsoft doc. Users may add quick actions to the message card. The action would bond the user with MS Teams and their services. There are four types of actions available in the Message card.

  • OpenUri

  • HttpPOST

  • ActionCard

  • InvokeAddInCommand

OpenUri: It allows users to navigate from MS Teams to the user’s portal. This will increase user engagement and productivity towards the application.

HttpPOST: Users may POST content to any service from MS Teams to custom service. The target service needs to authenticate the POST call requested from MS Teams. Microsoft adds the bearer token in all the HTTP requests. The token is a JSON web token(JWT) signed by Microsoft and it includes Tenant and user’s identification.

ActionCard: This can be used with HttpPOST. You may wish to take some input from the user along with action buttons. Generally, this can be used when you take a small survey, adding comments or take users’ choice of actions. Users can post their views along with actions in Teams.

InvokeAddInCommand: This action results in Microsoft outlook. Outlook opens the requests from Teams and makes the initialization context specified by the action available to the add-in.

In conclusion, MS Teams connector is an easy option to get your organization data to Teams and perform the bidirectional action between Teams and your service.

 
 

Author
NADIR RIYANI

Nadir Riyani is a Technical Lead at Crest Data, with 12+ years of experience in Software development. He has successfully delivered software products for Financial, Inventory, Sales, Manufacturing, and Transportation domains. At Crest Data, Nadir has worked with several cloud providers and frameworks like AWS, Azure, and Splunk. Prior to Crest, Nadir has worked as a Team Lead for MSBC Group.

 
Previous
Previous

Vulnerability detection using VulnDB integration with Nmap

Next
Next

Advanced Threat Hunting Harnessing Chronicle Backstory with Demisto