callWebHook
Calls a webhook to trigger a system to do anything like posting a message to a teams channel.
Parameters
url - The url of the teams or slack channel, see the video to learn how to get a WebHook url.
2. the message you want to send. That depends on the service, you want to post to. here are some examples for Microsoft Teams(https://docs.microsoft.com/de-de/microsoftteams/platform/webhooks-and-connectors/how-to/connectors-using), but it can be as easy as seen in example 1
Example Usages
Plain text message
app.callWebHook(myUrl, {
text: "Hello World",
});
full styled message with actions
app.callWebHook(myUrl, {
"@type": "MessageCard",
"@context": "http://schema.org/extensions",
themeColor: "006E7E",
summary: "A new message from Gebra Suite",
sections: [
{
activityTitle:
"A new message from Gebra Suite",
activitySubtitle: "Sandbox",
activityImage:
"https://teamsnodesample.azurewebsites.net/static/img/image5.png",
facts: [
{
name: "Assigned to",
value: app.userId,
},
],
markdown: true,
},
],
potentialAction: [
{
"@type": "ActionCard",
name: "Add a comment",
inputs: [
{
"@type": "TextInput",
id: "comment",
isMultiline: false,
title: "Add a comment here for this task",
},
],
actions: [
{
"@type": "HttpPOST",
name: "Add comment",
target: "http://...",
},
],
},
{
"@type": "ActionCard",
name: "Set due date",
inputs: [
{
"@type": "DateInput",
id: "dueDate",
title: "Enter a due date for this task",
},
],
actions: [
{
"@type": "HttpPOST",
name: "Save",
target: "http://...",
},
],
},
{
"@type": "ActionCard",
name: "Change status",
inputs: [
{
"@type": "MultichoiceInput",
id: "list",
title: "Select a status",
isMultiSelect: "false",
choices: [
{
display: "In Progress",
value: "1",
},
{
display: "Active",
value: "2",
},
{
display: "Closed",
value: "3",
},
],
},
],
actions: [
{
"@type": "HttpPOST",
name: "Save",
target: "http://...",
},
],
},
],
});
Return Values
The function returns the result of the (internal) "fetch" function. The "fetch" function returns a "Promise" that resolves to the "Response" to that request. Since the function is marked as async, it implicitly returns a promise.
Last updated
Was this helpful?