|
3 | 3 | :markdown
|
4 | 4 | ## What does this thing do?
|
5 | 5 |
|
6 |
| - This [Express.js](http://expressjs.com/) sample application |
| 6 | + This [Express.js](//expressjs.com/) sample application |
7 | 7 | demonstrates how to send SMS alerts to a list of system
|
8 | 8 | administrators if something goes wrong on your server. In this
|
9 | 9 | tutorial, we'll show you the key bits of code to make this work.
|
10 | 10 | Head to the [application's
|
11 |
| - README.md](https://github.com/TwilioDevEd/server-notifications-node) |
| 11 | + README.md](//github.com/TwilioDevEd/server-notifications-node) |
12 | 12 | to see how to run the application locally.
|
13 | 13 |
|
14 | 14 | Let's get started!
|
15 | 15 |
|
16 | 16 | ---
|
17 | 17 |
|
18 | 18 | **See Also:**
|
19 |
| - * [Getting started with Express.js](http://expressjs.com/starter/hello-world.html) |
20 |
| - * [twilio-node library](http://twilio.github.io/twilio-node/) |
| 19 | + * [Getting started with Express.js](//expressjs.com/starter/hello-world.html) |
| 20 | + * [twilio-node library](//twilio.github.io/twilio-node/) |
21 | 21 |
|
22 | 22 | .step(data-file='config.js', data-highlight='23-45')
|
23 | 23 | :markdown
|
24 | 24 | ## Configure Twilio client
|
25 | 25 |
|
26 | 26 | In order to send messages we'll need to create a [Twilio REST
|
27 |
| - client](http://twilio.github.io/twilio-node/#quickstart), which |
| 27 | + client](//twilio.github.io/twilio-node/#quickstart), which |
28 | 28 | requires reading our `TWILIO_ACCOUNT_SID`, `TWILIO_NUMBER`
|
29 | 29 | `TWILIO_AUTH_TOKEN` from the enviroment. We also make the
|
30 | 30 | variables available through the `config` module.
|
31 | 31 |
|
32 | 32 | ---
|
33 | 33 |
|
34 | 34 | **See Also:**
|
35 |
| - * [twilio-node Quickstart](http://twilio.github.io/twilio-node/#quickstart) |
36 |
| - * [Twilio REST Web Service Interface](https://www.twilio.com/docs/api/rest) |
| 35 | + * [twilio-node Quickstart](//twilio.github.io/twilio-node/#quickstart) |
| 36 | + * [Twilio REST Web Service Interface](//www.twilio.com/docs/api/rest) |
37 | 37 |
|
38 | 38 | .step(data-file='config/administrators.json')
|
39 | 39 | :markdown
|
|
49 | 49 |
|
50 | 50 | We will implement error handling and message delivery as a piece
|
51 | 51 | of [Express.js
|
52 |
| - middleware](http://expressjs.com/guide/using-middleware.html). We |
| 52 | + middleware](//expressjs.com/guide/using-middleware.html). We |
53 | 53 | will make all the Twilio API calls from there.
|
54 | 54 |
|
55 | 55 | ---
|
56 | 56 |
|
57 | 57 | **See Also:**
|
58 |
| - * [Error handling middleware](http://expressjs.com/guide/using-middleware.html#middleware.error-handling) |
| 58 | + * [Error handling middleware](//expressjs.com/guide/using-middleware.html#middleware.error-handling) |
59 | 59 |
|
60 | 60 | .step(data-file='middleware/twilioNotifications.js')
|
61 | 61 | :markdown
|
62 | 62 | ## Trigger notifications for administrator list
|
63 | 63 |
|
64 | 64 | In our Express middleware module, we read the admins from our JSON file
|
65 |
| - and send alert messages to each of them with the `sendSms` method in |
| 65 | + and send alert messages to each of them with the `sendSms` method in |
66 | 66 | `twilioClient`. We also call `next` with the error object, which will
|
67 | 67 | allow other configured error handling middleware to execute.
|
68 | 68 |
|
|
71 | 71 | ## Send a text message
|
72 | 72 |
|
73 | 73 | There are the three parameters needed to [send an
|
74 |
| - SMS](http://twilio.github.io/twilio-node/#moreexamples) |
| 74 | + SMS](//twilio.github.io/twilio-node/#moreexamples) |
75 | 75 | using the [Twilio REST
|
76 |
| - API](https://www.twilio.com/docs/api/rest): `From`, `To`, and |
| 76 | + API](//www.twilio.com/docs/api/rest): `From`, `To`, and |
77 | 77 | `Body`. [US and Canadian phone
|
78 |
| - numbers](https://www.twilio.com/help/faq/sms/is-mms-supported-for-all-carriers-in-us-and-canada) |
| 78 | + numbers](//www.twilio.com/help/faq/sms/is-mms-supported-for-all-carriers-in-us-and-canada) |
79 | 79 | can also send an image with the message.
|
80 | 80 |
|
81 | 81 | ---
|
82 | 82 |
|
83 | 83 | **See Also:**
|
84 |
| - * [REST API Docs for Message resource](https://www.twilio.com/docs/api/rest/message) |
85 |
| - * [Your message logs in the account portal](https://www.twilio.com/user/account/log/messages) |
| 84 | + * [REST API Docs for Message resource](//www.twilio.com/docs/api/rest/message) |
| 85 | + * [Your message logs in the account portal](//www.twilio.com/user/account/log/messages) |
86 | 86 |
|
87 | 87 | .step
|
88 | 88 | :markdown
|
89 | 89 | ## Where to next?
|
90 | 90 |
|
91 |
| - That's it! We've just implemented an automated server notification system |
| 91 | + That's it! We've just implemented an automated server notification system |
92 | 92 | that can send you server alerts if anything goes wrong. If you're a Node.js
|
93 | 93 | developer working with Twilio, you might want to check out these other
|
94 | 94 | tutorials.
|
95 | 95 |
|
96 |
| - [**Two-Factor Authentication**](https://www.twilio.com/docs/howto/walkthrough/two-factor-authentication/node/express) |
| 96 | + [**Two-Factor Authentication**](//www.twilio.com/docs/howto/walkthrough/two-factor-authentication/node/express) |
97 | 97 |
|
98 | 98 | Increase the security of your login system by verifying a user's mobile
|
99 | 99 | phone in addition to their password.
|
100 | 100 |
|
101 |
| - [**SMS and MMS marketing notifications**](https://www.twilio.com/docs/howto/walkthrough/marketing-notifications/node/express) |
| 101 | + [**SMS and MMS marketing notifications**](//www.twilio.com/docs/howto/walkthrough/marketing-notifications/node/express) |
102 | 102 |
|
103 | 103 | SMS and MMS messages are a personal way to engage with users, offering
|
104 | 104 | a much higher open rate than e-mail and more impact than a tweet.
|
105 | 105 |
|
106 | 106 |
|
107 |
| - |
108 | 107 | ### Did this help?
|
109 | 108 |
|
110 |
| - Thanks for checking out this tutorial! If you have any feedback to share |
111 |
| - with us, we'd love to hear it. Tweet [@twilio](http://twitter.com/twilio) |
112 |
| - to let us know what you think. |
113 |
| - |
| 109 | + Thanks for checking out this tutorial! If you have any feedback |
| 110 | + to share with us, we'd love to hear it. [Contact the Twilio Developer |
| 111 | + Education Team](mailto: [email protected]) to let us know what you think. |
0 commit comments