Skip to main content
10-Marble
Aug 11, 2021 7:42 AM UTC
Question

Thingworx Alert to MS Teams

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?

19 replies

22-Sapphire I
Aug 11, 2021 2:02 PM UTC

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

Translate
10-Marble
Aug 11, 2021 5:47 PM UTC
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,
};
Translate
10-Marble
Aug 11, 2021 6:13 PM UTC

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);
Translate
Support
Aug 19, 2021 5:56 PM UTC

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

Translate
10-Marble
Sep 2, 2021 2:20 PM UTC

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

Translate
1-Visitor
Sep 2, 2021 4:41 PM UTC

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.

Translate
10-Marble
Sep 3, 2021 7:46 AM UTC


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

Translate
Support
Sep 27, 2021 8:20 PM UTC

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

Translate
15-Moonstone
Nov 28, 2022 9:00 AM UTC

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. 

 

Translate