Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
page_type description products languages extensions
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.
office-teams
office
office-365
nodejs
javascript
contentType createdDate
samples
7/1/2022 2:36:57 PM

Incoming webhook

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.

tab

card by webhook

  • HttpPOST action response
  • Note: To see Post action please set target as https://{{base-url}}/api/save

post action response

Prerequisites

  • NodeJS
  • ngrok or equivalent tunnelling solution
  • Teams Microsoft Teams is installed and you have an account

To try this sample

  1. Create a incoming webhook. Create incoming webhooks. Keep this webhook URL handy while running the sample.

  2. Clone the repository

    git clone https://github.com/OfficeDev/Microsoft-Teams-Samples.git
  3. 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
  4. 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

  5. Run ngrok - point to port 3000 (pointing to ClientApp)

    # ngrok http -host-header=rewrite 3000
  6. 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
  7. Zip the contents of AppPackage folder into a manifest.zip, and use the manifest.zip to deploy in app store or add to Teams.

  8. Run both solutions i.e. samples/incoming-webhoook/nodejs/api and samples/incoming-webhoook/nodejs/clientapp

    npm start
    
  9. 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.

Features of the sample

  • Open Incoming webhook tab.
  • Update webhook URL in Enter webhook URL input field and card payload in Card payload editor.
  • Click on send button. You will get a card from webhook in the team where incoming webhook is added.

Testing the bot using Bot Framework Emulator

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

Further reading