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);

