Skip to main content
10-Marble
August 11, 2021
Question

Thingworx Alert to MS Teams

  • August 11, 2021
  • 5 replies
  • 6893 views

Good day everyone! Has anyone integrated MS Teams with Thingworx? You need to create a service similar to Twillio to be able to send notification to MS Teams. What is the template for implementing this service? Is it enough to just use the API to create a connection?

5 replies

22-Sapphire I
August 11, 2021

If you know how to use the Teams API that would be the way, don't think there is a connector/template for it.

10-Marble
August 11, 2021
I tried to set up a service in the same way with Twillio, but there were always some conflicts, but there were ...
I haven't been working for TW for that long, tell me how await works ... Also, I don't understand why TW swears at a construction like:

const options = {
	authProvider,
};
10-Marble
August 11, 2021

Do I understand correctly that I need to write an analogue of Twillio?

// twillio
var employeeList = Groups[employees].GetGroupMembers();
for (var x = 0; x < employeesList.getRowCount(); x++) {
 var employee = employeesList.getRow(x);
 var params = {
 to: employee.smsAddress,
 text: "Hey, " + employee.firstName + "." + message
 };
 me.SendSMSMessage(params);
}
//teams api integr.
const options = {
	authProvider,
};
const client = Client.init(options);
const chatMessage = {
 body: {
 content: 'Hello World'
 }
};
await client.api('/teams/fbe2bf47-16c8-47cf-b4a5-4b9b187c508b/channels/19:4a95f7d8db4c4e7fae857bcebe0623e6@thread.tacv2/messages')
	.post(chatMessage);
Community Manager
August 19, 2021

Hi @Egor.Litvinov

 

If you feel your question has been answered, please mark the appropriate response as the Accepted Solution for the benefit of others with the same question.

 

Regards.

 

--Sharon

10-Marble
September 2, 2021

Good time everyone!
I just can't figure out how to set up integration with Teams ... Please, tell me how I can get the API key of the chat / group / teams channel, so that I can use it in the future to send messages from TW. Also it is not clear to me how to implement the service for sending messages. The code that I posted above ThingWorx refuses to accept

1-Visitor
September 2, 2021

I've been thinking about this since it's on our backlog for our next internal ThingWorx release. Have you written a Teams App before? I don't think you can call the MS Graph API as an Application and send messages. Teams Apps however can initiate chats and send notifications.

10-Marble
September 3, 2021


In general, I see two options for implementation:
1) Directly through the API, if it works, this is the best option, but so far nothing has really worked out for me
2) Through a "crutch", through some ready-made service, send notifications to some bot, which will already process messages on the other side and send them to channels / chats

Community Manager
September 27, 2021

Hi @Egor.Litvinov.

 

If you feel your question has been answered, please mark the appropriate response as the Accepted Solution for the benefit of others with the same question.

 

Regards.

 

--Sharon

15-Moonstone
November 28, 2022

Hi @Egor.Litvinov ,


If your idea is focued on teams channel then you can try incoming webhooks connector and use the restAPI to publish your messages in MS Teams channel.