page_type | description | products | languages | extensions | urlFragment | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
sample |
This sample shows a feature where user can schedule a task from messaging extension action and get a reminder card at a scheduled time. |
|
|
|
officedev-microsoft-teams-samples-msgext-message-reminder-nodejs |
This sample shows a feature where user can schedule a task from messaging extension action and get a reminder card at a scheduled time.
- Microsoft Teams is installed and you have an account (not a guest account)
- NodeJS
- ngrok or equivalent tunneling solution
- M365 developer account or access to a Teams account with the appropriate permissions to install an app.
-
Register a new application in the Azure Active Directory – App Registrations portal.
-
Setup for Bot
- In Azure portal, create a Azure Bot resource.
- Ensure that you've enabled the Teams Channel
- While registering the bot, use
https://<your_ngrok_url>/api/messages
as the messaging endpoint. NOTE: When you create app registration, you will create an App ID and App password - make sure you keep these for later.
- Setup NGROK
-
Run ngrok - point to port 3978
ngrok http -host-header=rewrite 3978
-
Setup for code
- Clone the repository
git clone https://github.com/OfficeDev/Microsoft-Teams-Samples.git
- Update the
.env
configuration for the bot to use theMicrosoftAppId
andMicrosoftAppPassword
,BaseUrl
with application base url. For e.g., your ngrok url. (Note the MicrosoftAppId is the AppId created in step 1 (Setup for Bot), the MicrosoftAppPassword is referred to as the "client secret" in step 1 (Setup for Bot) and you can always create a new client secret anytime.)
-
In the folder where repository is cloned navigate to
samples/bot-task-reminder/nodejs
-
Install modules
npm install
-
Run your app
npm start
-
Setup Manifest for Teams
-
This step is specific to Teams.
- Edit the
manifest.json
contained in the ./AppPackage folder to replace your Microsoft App Id (that was created when you registered your app registration earlier) everywhere you see the place holder string{{Microsoft-App-Id}}
(depending on the scenario the Microsoft App Id may occur multiple times in themanifest.json
) - Edit the
manifest.json
forvalidDomains
and replace{{domain-name}}
with base Url of your domain. E.g. if you are using ngrok it would behttps://1234.ngrok.io
then your domain-name will be1234.ngrok.io
. - Zip up the contents of the
AppPackage
folder to create amanifest.zip
(Make sure that zip file does not contains any subfolder otherwise you will get error while uploading your .zip package)
- Edit the
-
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.
- Personal scope scenario
Select
...
over message to get actioncreate-reminder
for scheduling task.
Task module to schedule a task.
Reminder card of task at scheduled date and time.
- Team scope scenario Navigate to team where the app is installed
Select ...
over message to get action create-reminder
for scheduling task.
Task module to schedule a task.
Reminder card of task at scheduled date and time.