Skip to content

Commit 8f57270

Browse files
authored
Merge pull request #18 from microsoftgraph/jasonjoh-patch-1
Minor fixes
2 parents 3618945 + 2e1d8c8 commit 8f57270

File tree

2 files changed

+7740
-61
lines changed

2 files changed

+7740
-61
lines changed

README.md

Lines changed: 63 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,115 +1,116 @@
11
# Microsoft Graph Webhooks Sample for Node.js
2+
23
[![Build Status](https://travis-ci.org/microsoftgraph/nodejs-webhooks-rest-sample.svg)](https://travis-ci.org/microsoftgraph/nodejs-webhooks-rest-sample)
34

45
This Node.js sample shows how to start getting notifications from Microsoft Graph. The following are common tasks that a web application performs with Microsoft Graph webhooks.
56

6-
* Sign-in your users with their work or school account to get an access token.
7-
* Use the access token to create a webhook subscription.
8-
* Send back a validation token to confirm the notification URL.
9-
* Listen for notifications from Microsoft Graph.
10-
* Request for more information in Microsoft Office 365 using data in the notification.
7+
- Sign-in your users with their work or school account to get an access token.
8+
- Use the access token to create a webhook subscription.
9+
- Send back a validation token to confirm the notification URL.
10+
- Listen for notifications from Microsoft Graph.
11+
- Request for more information in Microsoft Office 365 using data in the notification.
1112

1213
## Screenshots
1314

1415
1. First you need sign in.
1516

16-
![sign in](https://user-images.githubusercontent.com/3375461/31968683-c373ad30-b8c6-11e7-9d01-413fab9fd6d5.png)
17+
![sign in](https://user-images.githubusercontent.com/3375461/31968683-c373ad30-b8c6-11e7-9d01-413fab9fd6d5.png)
1718

18-
2. Once signing in, the app will listen to the incoming emails.
19+
1. Once signing in, the app will listen to the incoming emails.
1920

20-
![listening](https://user-images.githubusercontent.com/3375461/31968718-e19696c4-b8c6-11e7-91f2-f1806be0b134.png)
21+
![listening](https://user-images.githubusercontent.com/3375461/31968718-e19696c4-b8c6-11e7-91f2-f1806be0b134.png)
2122

22-
3. After sending the email to the address, you will see the email in the app.
23+
1. After sending the email to the address, you will see the email in the app.
2324

24-
![email](https://user-images.githubusercontent.com/3375461/31968754-0ce4dafc-b8c7-11e7-8458-8152d598228e.png)
25+
![email](https://user-images.githubusercontent.com/3375461/31968754-0ce4dafc-b8c7-11e7-8458-8152d598228e.png)
2526

2627
## Prerequisites
2728

2829
To use the Webhook sample, you need the following:
2930

30-
* [Node.js](https://nodejs.org/) version 4 or 5.
31-
* A [work or school account](http://dev.office.com/devprogram).
31+
- [Node.js](https://nodejs.org/) version 4 or 5.
32+
- A [work or school account](http://dev.office.com/devprogram).
3233

3334
## Register the app
3435

3536
This app uses the Azure AD endpoint, so you'll register it in the [Azure Portal](https://ms.portal.azure.com/#blade/Microsoft_AAD_IAM/ApplicationsListBlade).
3637

3738
1. Sign in to the portal using your work or school account.
3839

39-
2. Choose **New application registration**.
40-
41-
a. Enter a friendly name for the application.
40+
1. Choose **New application registration**.
4241

43-
b. Choose 'Web app/API' as the **Application Type**.
42+
1. Enter a friendly name for the application.
43+
1. Choose 'Web app/API' as the **Application Type**.
44+
1. Enter `http://localhost:3000/callback` for the **Sign-on URL**.
45+
1. Click **Create**.
4446

45-
c. Enter *http://localhost:3000/callback* for the **Sign-on URL**.
46-
47-
d. Click **Create**.
47+
1. Choose your new application from the list of registered applications.
4848

49-
3. Choose your new application from the list of registered applications.
49+
1. Copy and store the Application ID. This value is shown in the **Essentials** pane or in **Settings** > **Properties**.
5050

51-
4. Copy and store the Application ID. This value is shown in the **Essentials** pane or in **Settings** > **Properties**.
51+
1. To enable multi-tenanted support for the app, choose **Settings** > **Properties** and set **Multi-tenanted** to **Yes**.
5252

53-
5. To enable multi-tenanted support for the app, choose **Settings** > **Properties** and set **Multi-tenanted** to **Yes**.
53+
1. Configure permissions for your application:
5454

55-
6. Configure permissions for your application:
55+
1. Choose **Settings** > **Required permissions** > **Add**.
56+
1. Choose **Select an API** > **Microsoft Graph**, and then click **Select**.
57+
1. Choose **Select permissions**, scroll down to **Delegated Permissions**, choose **Read user mail**, and then click **Select**.
58+
1. Click **Done**.
5659

57-
a. Choose **Settings** > **Required permissions** > **Add**.
58-
59-
b. Choose **Select an API** > **Microsoft Graph**, and then click **Select**.
60-
61-
c. Choose **Select permissions**, scroll down to **Delegated Permissions**, choose **Read user mail**, and then click **Select**.
62-
63-
d. Click **Done**.
60+
1. Choose **Settings** > **Keys**. Enter a description, choose a duration for the key, and then click **Save**.
6461

65-
7. Choose **Settings** > **Keys**. Enter a description, choose a duration for the key, and then click **Save**.
66-
67-
8. **Important**: Copy the key value--this is your app's secret. You won't be able to access this value again after you leave this blade.
62+
1. **Important**: Copy the key value--this is your app's secret. You won't be able to access this value again after you leave this blade.
6863

6964
You'll use the application ID and secret to configure the app.
7065

7166
## Configure a tunnel for your localhost
7267

73-
The sample uses *localhost* as the development server. For this reason, we need a tunnel that can forward requests from a URL on the Internet to our *localhost*. If for any reason, you don't want to use a tunnel, see [Hosting without a tunnel](https://github.com/OfficeDev/Microsoft-Graph-Nodejs-Webhooks/wiki/Hosting-the-sample-without-a-tunnel). If you want a detailed explanation about why to use a tunnel, see [Why do I have to use a tunnel?](https://github.com/OfficeDev/Microsoft-Graph-Nodejs-Webhooks/wiki/Why-do-I-have-to-use-a-tunnel)
68+
The sample uses localhost as the development server. For this reason, we need a tunnel that can forward requests from a URL on the Internet to your localhost. If for any reason, you don't want to use a tunnel, see [Hosting without a tunnel](https://github.com/OfficeDev/Microsoft-Graph-Nodejs-Webhooks/wiki/Hosting-the-sample-without-a-tunnel). If you want a detailed explanation about why to use a tunnel, see [Why do I have to use a tunnel?](https://github.com/OfficeDev/Microsoft-Graph-Nodejs-Webhooks/wiki/Why-do-I-have-to-use-a-tunnel)
7469

7570
For this sample, we use [ngrok](https://ngrok.com/) to create the tunnel. To configure ngrok:
7671

7772
1. [Download](https://ngrok.com/download) and unzip the ngrok binaries for your platform.
78-
2. Type the following command:
79-
80-
`ngrok http 3000`
81-
82-
3. Take note of the *https public URL* that ngrok provides for you. This is an example:
73+
1. Type the following command:
74+
75+
```Shell
76+
ngrok http 3000
77+
```
78+
79+
1. Take note of the *https public URL* that ngrok provides for you. This is an example:
8380

84-
`https://NGROK_ID.ngrok.io`
81+
```http
82+
https://{NGROK_ID}.ngrok.io
83+
```
8584

86-
You'll need the *NGROK_ID* value in the next section.
85+
You'll need the `NGROK_ID` value in the next section.
8786
8887
## Configure and run the web app
8988
9089
1. Use a text editor to open `constants.js`.
91-
2. Replace *ENTER_YOUR_CLIENT_ID* with the client ID of your registered Azure application.
92-
3. Replace *ENTER_YOUR_SECRET* with the client secret of your registered Azure application.
93-
4. Replace *NGROK_ID* with the value in *https public URL* from the previous section.
94-
5. Install the dependencies running the following command:
95-
```
90+
1. Replace `ENTER_YOUR_CLIENT_ID` with the client ID of your registered Azure application.
91+
1. Replace `ENTER_YOUR_SECRET` with the client secret of your registered Azure application.
92+
1. Replace `NGROK_ID` with the value in *https public URL* from the previous section.
93+
1. Install the dependencies running the following command:
94+
95+
```Shell
9696
npm install
9797
```
9898
99-
6. Start the application with the following command:
100-
```
99+
1. Start the application with the following command:
100+
101+
```Shell
101102
npm start
102103
```
103-
> Note: You can also make the application wait for a debugger. To wait for a debugger, use the following command instead:
104-
```
105-
npm run debug
106-
```
107-
You can attach the debugger included in Microsoft Visual Studio Code. For more information, see [Debugging in Visual Studio Code](https://code.visualstudio.com/Docs/editor/debugging).
108-
109-
7. Open a browser and go to http://localhost:3000.
104+
> **Note:** You can also make the application wait for a debugger. To wait for a debugger, use the following command instead:
105+
>
106+
> ```Shell
107+
> npm run debug
108+
> ```
109+
> You can also attach the debugger included in Microsoft Visual Studio Code. For more information, see [Debugging in Visual Studio Code](https://code.visualstudio.com/Docs/editor/debugging).
110+
111+
1. Open a browser and go to [http://localhost:3000](http://localhost:3000).
110112
111-
<a name="contributing"></a>
112-
## Contributing ##
113+
## Contributing
113114
114115
If you'd like to contribute to this sample, see [CONTRIBUTING.MD](/CONTRIBUTING.md).
115116

@@ -120,11 +121,12 @@ This project has adopted the [Microsoft Open Source Code of Conduct](https://ope
120121
We'd love to get your feedback about the Microsoft Graph Webhook sample. You can send your questions and suggestions to us in the [Issues](https://github.com/OfficeDev/Microsoft-Graph-NodeJs-Webhooks/issues) section of this repository.
121122
122123
Office 365 development questions? Post them to [Stack Overflow](http://stackoverflow.com/questions/tagged/Office365+API). Make sure to tag your questions or comments with [Office365] and [API].
123-
124+
124125
## Additional resources
125126
126-
* [Overview of Microsoft Graph](http://graph.microsoft.io/)
127-
* [Subscription reference documentation](https://graph.microsoft.io/en-us/docs/api-reference/beta/resources/subscription)
127+
- [Overview of Microsoft Graph](http://graph.microsoft.io/)
128+
- [Subscription reference documentation](https://graph.microsoft.io/en-us/docs/api-reference/beta/resources/subscription)
128129
129130
## Copyright
130-
Copyright (c) 2016 Microsoft. All rights reserved.
131+
132+
Copyright (c) 2016 Microsoft. All rights reserved.

0 commit comments

Comments
 (0)