page_type | description | products | languages | extensions | urlFragment | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
sample |
This sample demos UI to type in Incoming Webhook URL and message card payload, which send the card in the team also demonstrates the HttpPOST action in the card. |
|
|
|
officedev-microsoft-teams-samples-incoming-webhook-nodejs |
This sample demos UI to type in Incoming Webhook URL and message card payload, which send the card in the team also demonstrates the HttpPOST action in the card.
- HttpPOST action response
- Note: To see Post action please set target as
https://{{base-url}}/api/save
- NodeJS
- ngrok or equivalent tunnelling solution
- Teams Microsoft Teams is installed and you have an account
-
Create a incoming webhook. Create incoming webhooks. Keep this webhook URL handy while running the sample.
-
Clone the repository
git clone https://github.com/OfficeDev/Microsoft-Teams-Samples.git
-
Install node modules
Inside node js folder, navigate to
samples/incoming-webhoook/nodejs/api
open your local terminal and run the below command to install node modules. You can do the same in Visual Studio code terminal by opening the project in Visual Studio code.- Repeat the same step in folder
samples/incoming-webhoook/nodejs/ClientApp
npm install
- Repeat the same step in folder
-
We have two different solutions to run so follow below steps:
A) In a terminal, navigate to
samples/incoming-webhoook/nodejs/api
B) In a different terminal, navigate to
samples/incoming-webhoook/nodejs/ClientApp
-
Run ngrok - point to port 3000 (pointing to ClientApp)
# ngrok http -host-header=rewrite 3000
-
Modify the
manifest.json
in the/AppPackage
folder and replace the following details{{Manifest-id}}
with some unique GUID.{{Domain Name}}
with your application's base url, e.g. https://1234.ngrok.io
-
Zip the contents of
AppPackage
folder into amanifest.zip
, and use themanifest.zip
to deploy in app store or add to Teams. -
Run both solutions i.e.
samples/incoming-webhoook/nodejs/api
andsamples/incoming-webhoook/nodejs/clientapp
npm start
-
Upload the manifest.zip to Teams (in the Apps view click "Upload a custom app")
- Go to Microsoft Teams. From the lower left corner, select Apps
- From the lower left corner, choose Upload a custom App
- Go to your project directory, the ./AppPackage folder, select the zip folder, and choose Open.
- Select Add in the pop-up dialog box. Your app is uploaded to Teams.
- Open Incoming webhook tab.
- Update webhook URL in
Enter webhook URL
input field and card payload inCard payload editor
. - Click on send button. You will get a card from webhook in the team where incoming webhook is added.
Bot Framework Emulator is a desktop application that allows bot developers to test and debug their bots on localhost or running remotely through a tunnel.
- Install the Bot Framework Emulator version 4.5.0 or greater from here