Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X
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);
Solved! Go to Solution.
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).
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
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.
/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).