forked from OfficeDev/Microsoft-Teams-Samples
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added generic connector sample code (OfficeDev#4)
* Added generic connector sample code
- Loading branch information
1 parent
1b2923f
commit a7053b9
Showing
16 changed files
with
1,021 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# TypeScript v1 declaration files | ||
typings/ | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
|
||
# next.js build output | ||
.next |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) Microsoft Corporation. All rights reserved. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Sample Connector | ||
This contains the source for a generic connector that's easy to customize for any system which supports webhooks. | ||
|
||
## Prerequisites | ||
To complete this tutorial, you need the following tools. If you don't already have them you can install them from these links. | ||
|
||
* [Git](https://git-scm.com/downloads) | ||
* [Node.js and NPM](https://nodejs.org/) | ||
* Get any text editor or IDE. You can install and use [Visual Studio Code](https://code.visualstudio.com/download) for free. | ||
* An Office 365 account with access to Microsoft Teams, with [sideloading enabled](https://docs.microsoft.com/microsoftteams/platform/concepts/build-and-test/prepare-your-o365-tenant#enable-custom-teams-apps-and-turn-on-custom-app-uploading). | ||
* If you want to run this code locally, use a tunnelling service. These instructions assume you are using [ngrok](https://ngrok.com/). | ||
|
||
### Configure your own connector | ||
|
||
1. Start the tunnelling service to get an https endpoint. | ||
1. Open a new command prompt window. | ||
1. Change to the directory that contains the ngrok.exe application. | ||
1. In the command prompt, run the command `ngrok http 3978 --host-header=localhost`. | ||
1. Ngrok will fill the entire prompt window. Make note of the https:// Forwarding URL. This URL will be your [BASE_URI] referenced below. | ||
1. Minimize the ngrok Command Prompt window. It is no longer referenced in these instructions, but it must remain running. | ||
1. [Register a new connector](https://docs.microsoft.com/microsoftteams/platform/webhooks-and-connectors/how-to/connectors-creating#adding-a-connector-to-your-teams-app) | ||
1. Open [Connector Developer Portal](https://outlook.office.com/connectors/home/login/#/new) and select New Connector. | ||
1. Fill in all the basic details such as name, logo, descriptions etc. for the new connector. | ||
1. For the configuration page, you'll use our sample code's setup endpoint: `https://[BASE_URI]/connector/setup` | ||
1. For Valid domains, make enter your domain's http or https URL, e.g. XXXXXXXX.ngrok.io. | ||
1. Click on Save. After the save completes, you will see your connector ID in address bar. | ||
1. In the `~/views/connectorconfig.jade` file line 27 and replace `ngrokURL` to the ngrok https forwarding url from the above. | ||
1. Install all the dependencies by running `npm install` in root directory. | ||
1. Run the sample: `node server.js` | ||
1. Manifest updates: | ||
1. Replace `ConnectorId` field in `~/app manifest/manifest.json` file with your newly registered connector ID. | ||
1. Select all three files (manifest.json, outline_icon.png, color_icon.png) and create a zip file. This is your Teams App Manifest package. | ||
1. Now you can [upload your app manifest](https://docs.microsoft.com/microsoftteams/platform/concepts/deploy-and-publish/apps-upload#upload-your-package-into-a-team-using-the-apps-tab) package in a team and test your new connector by following instructions in config UI. | ||
|
||
## More Information | ||
For more information about getting started with Teams, please review the following resources: | ||
- Review [Office 365 Connectors](https://docs.microsoft.com/microsoftteams/platform/webhooks-and-connectors/how-to/connectors-creating) | ||
- Review [Understanding Teams app capabilities](https://docs.microsoft.com/microsoftteams/platform/concepts/capabilities-overview) | ||
|
||
## Contributing | ||
|
||
This project welcomes contributions and suggestions. Most contributions require you to agree to a | ||
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us | ||
the rights to use your contribution. For details, visit https://cla.microsoft.com. | ||
|
||
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide | ||
a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions | ||
provided by the bot. You will only need to do this once across all repos using our CLA. | ||
|
||
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). | ||
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or | ||
contact [[email protected]](mailto:[email protected]) with any additional questions or comments. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.8/MicrosoftTeams.schema.json", | ||
"manifestVersion": "1.8", | ||
"id": "3ea203f0-07f0-46d2-8da3-4639b616cf37", | ||
"version": "1.0", | ||
"packageName": "com.NotifyMe", | ||
"developer": { | ||
"name": "Developer", | ||
"websiteUrl": "https://www.microsoft.com", | ||
"privacyUrl": "https://www.microsoft.com", | ||
"termsOfUseUrl": "https://www.microsoft.com" | ||
}, | ||
"name": { | ||
"full": "NotifyMe", | ||
"short": "NotifyMe" | ||
}, | ||
"accentColor": "#FFFFFF", | ||
"description": { | ||
"full": "Sample to show how to configure a connector and send notifications inside teams", | ||
"short": "Sample to show how connector works inside teams" | ||
}, | ||
"icons": { | ||
"outline": "outline_icon.png", | ||
"color": "color_icon.png" | ||
}, | ||
"connectors": [ | ||
{ | ||
"connectorId": "3ea203f0-07f0-46d2-8da3-4639b616cf37", | ||
"configurationUrl": "https://671872397d19.ngrok.io/connectorconfig", | ||
"scopes": [ | ||
"team" | ||
] | ||
} | ||
] | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"name": "connectersample", | ||
"version": "1.0.0", | ||
"main": "app.js", | ||
"dependencies": { | ||
"async": "^2.3.0", | ||
"body-parser": "^1.17.1", | ||
"config": "^1.26.1", | ||
"cookie-parser": "^1.4.3", | ||
"express": "^4.15.2", | ||
"express-partials": "^0.3.0", | ||
"express-session": "^1.15.2", | ||
"jade": "^1.11.0", | ||
"jquery": "^3.2.1", | ||
"method-override": "^2.3.8", | ||
"passport": "^0.3.2" | ||
}, | ||
"author": "", | ||
"license": "ISC", | ||
"description": "" | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.