callWebHook

Calls a webhook to trigger a system to do anything like posting a message to a teams channel.

Parameters

  1. 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 exampel 1

Example Usages

Plain text message

   brixxApi.callWebHook(myUrl, {
      text: "Hello World"
   });

full styled message with actions

   brixxApi.callWebHook(myUrl, {
      "@type": "MessageCard",
      "@context": "http://schema.org/extensions",
      "themeColor": "006E7E",
      "summary": "A new message from brixxbox",
      "sections": [{
         "activityTitle": "![TestImage](https://47a92947.ngrok.io/Content/Images/default.png)A new message from brixxbox",
         "activitySubtitle": "Volkers 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://..."
        }]
      }]
   });

Last updated