cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can change your system assigned username to something more personal in your community settings. X

JSON POST to Teams webhook

CL_9986028
4-Participant

JSON POST to Teams webhook

Hello,

 

Wondering if anyone can see any issue with this.  When putting the same things into SoapUI, everything goes thru fine......but when using content loader function postJSON it just times out.

 

// Define the data you want to send
var messageData =
{
"@type": "MessageCard",
"@context": "http://schema.org/extensions",
"themeColor": "0072C6",
"summary": "ThingWorx Data Update",
"sections": [
{
"activityTitle": "Data Update",
"activitySubtitle": "Timestamp: " + new Date().toUTCString(),
"facts": [
{
"name": "Sensor Name",
"value": "Sensor XYZ"
},
{
"name": "Value",
"value": "42.0"
}
]
}
]
};

let postData = JSON.stringify(messageData);

// Define the parameters for the HTTP POST request
var params = {
url: "https://generalmotors.webhook.office.com/webhookb2/4362b7f2-bfdd-48b0-b8f9-63637259d95b@5de110f8-2e0f-4d45-891d-bcf2218e253d/IncomingWebhook/blahblah", // Replace with your Microsoft Teams webhook URL
headers: {"Content-Type": "application/json"},
content: postData
};

// Send the data to the Teams webhook
result = Resources["ContentLoaderFunctions"].PostJSON(params);

 

 

 

 

 

 

ACCEPTED SOLUTION

Accepted Solutions

The key aspect to remember here is that whatever tests you do, should be done from the same baseline.

It does not matter if your SOAPUI call succeeded in your laptop, if you're trying the same call from another machine that does not have the same connectivity as yours. You are now in the situation where you need to understand what are the differences between the machine where you executed the SOAPUI call and the ThingWorx machine, and most certainly, it's the lack of internet access.

As Velkumar said, you're trying to access an internet URL in that snippet (unless you have a hosts mapping to an internal IP address in your laptop).

View solution in original post

4 REPLIES 4

Hi @CL_9986028 

 

Could you please check whether Thingworx Instance has access to the Internet. Time-out usually happens whenever the server cannot reach a specific endpoint. 

 

Try to consume API directly from the server using any REST Clients (Postman, Insomnia).

 

Also, try to access some public API ( Reqres - A hosted REST-API ready to respond to your AJAX requests ) from Thingworx.

 

/VR

CL_9986028
4-Participant
(To:Velkumar)

The thingworx instance does not have internet access.......but our teams servers are hosted internally I believe, so would i still need internet access if everything is on the intranet?

Hi @CL_9986028 

 

I don't think Teams can be hosted in On Premise Server. Based on Webhook which ends with office.com that requires internet access.

 

https://learn.microsoft.com/en-us/answers/questions/1183766/can-teams-be-installed-on-a-private-cloud-or-on-pr

/VR

The key aspect to remember here is that whatever tests you do, should be done from the same baseline.

It does not matter if your SOAPUI call succeeded in your laptop, if you're trying the same call from another machine that does not have the same connectivity as yours. You are now in the situation where you need to understand what are the differences between the machine where you executed the SOAPUI call and the ThingWorx machine, and most certainly, it's the lack of internet access.

As Velkumar said, you're trying to access an internet URL in that snippet (unless you have a hosts mapping to an internal IP address in your laptop).

Announcements


Top Tags