Level up your Twilio API skills in TwilioQuest, an educational game for Mac, Windows, and Linux. Download Now


Rate this page:

Thanks for rating this page!

We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

Instant Lead Alerts with Node.js and Express

You probably already have landing pages or product detail views which you're using to generate some excellent leads for your business. Would you like to let the sales team know when you've got a new qualified lead?

In this tutorial, we'll use Twilio Programmable SMS in a Node.js and Express application to send a message when a new lead is found.


We'll create a landing page for a new house on the market and notify a real estate agent the moment a potential customer requests information.

Porchが住宅の建設業者に新規プロジェクトに選定されたときに即時アラートを送信するためにTwilio SMSを使用する方法についてご紹介します。


        Let's build! Click the button below to continue.

        Let's Qualify Some Leads


        To display a landing page for our house we first need some information we'd like to display for the user.



              Next, let's look at how our landing page will be rendered.


              In our Jade template we insert data about the house.

              We'll also include a form in the sidebar which will let a user enter their contact information when they request more information.


                    Landing page template


                    Now that our Landing Page is ready, let's setup our Twilio Client to send messages to the sales team whenever a new lead comes in.

                    Twilio REST API クライアントの作成

                    次に、認証済み Twilio REST API クライアントを使ってヘルパークラスを作成する必要があります。このクライアントは、テキストメッセージを送信する必要があるときにいつでも使用できます。

                    We initialize it with our Twilio Account Credentials stored as environment variables. You can find the Auth Token and Account SID in the console:



                          Create a Twilio REST Client


                          Our Twilio Client is now ready to send messages. Next, let's see how we will handle an incoming lead.

                          Handle Hot Leads

                          POST リクエストの処理

                          このコードは、ランディングページによって発行された HTTP POST リクエストを処理します。

                          Here we use the Twilio REST API Client to send an SMS message to the real estate agent's phone number, which is stored in an environment variable. We include the lead's name, phone number, and inquiry directly in the body of the text message sent to the agent.



                                Handle a POST from the lead form


                                一丁上がり! テキストメッセージを使用して引き合いを即座に営業担当者にルーティングするアプリケーションを実装しました。

                                Itching to build more? We'll look at some other use cases in the next pane.



                                Node and Twilio - a great combination. Here are a couple other times we teamed them up for great results:

                                アポイントメント リマインダー

                                Learn to implement appointment reminders on your web app with Twilio, and avoid some of those no-shows.

                                Authy を使った 二要素認証

                                Twilio 対応 Authy を使って Web アプリに二要素認証(2FA)を実装する方法を学びます。


                                Thanks for checking out this tutorial! Tweet @twilio to let us know what you're building.

                                Kevin Whinnery Jose Oliveros Andrew Baker Paul Kamp Kat King
                                Rate this page:


                                誰しもが一度は考える「コーディングって難しい」。そんな時は、お問い合わせフォームから質問してください。 または、Stack Overflow でTwilioタグのついた情報から欲しいものを探してみましょう。