メニュー

Expand
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 PHP and Laravel

You probably already have landing pages or product detail views in your web application 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 PHP and Laravel application to send a message when a new lead is found.

In this example, we'll be implementing instant lead alerts for real estate.

We'll create a landing page for a new house on the market with a form to request more information. When a user submits the form we'll automatically notify a real estate agent in the field.

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

Let's begin! Click the below button to start the tutorial.

Let's Qualify Some Leads

Populate the Landing Page Data

To display a landing page for our house, we'll first need to store some data.

For demonstration purposes, we've hard-coded an associative array containing the information we'd like to display.

        
        
        
        
        app/Http/Controllers/HomeController.php

        Render listing data on the landing page

        app/Http/Controllers/HomeController.php

        Next, let's see how to render the landing page.

        ランディングページをレンダリングする

        In our blade template we'll insert data about the house. We'll also include a form in the sidebar to collect user contact details when they request more information.

              
              
              
              
              resources/views/home/index.blade.php

              Template to render the listing data

              resources/views/home/index.blade.php

              Now that we have a landing page, let's look at how we use the Twilio REST Client to send messages.

              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:

              コンソールの認証情報

                    
                    
                    
                    
                    app/Providers/TwilioServiceProvider.php

                    Initialize the Twilio REST Client

                    app/Providers/TwilioServiceProvider.php

                    Our Twilio REST Client is ready! Now, let's see what we do when a new lead comes in from the form.

                    React to a New Lead

                    POSTリクエストを処理する

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

                    It uses our sendMessage method 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 into the body of the text message we send to the agent.

                          
                          
                          
                          
                          app/Http/Controllers/NotificationsController.php

                          Automatically send qualified leads to the sales team

                          app/Http/Controllers/NotificationsController.php

                          And that's it! The agent has all the required information to immediately follow up on the lead.

                          We've just implemented an application to instantly route leads to sales people in the field using text messages. Next, we'll take a look at some other easy to integrate features for your PHP application.

                          他に構築できるもの

                          次はどこでしょうか?

                          PHP and Twilio go together so well - here's a couple of tutorials to prove it:

                          ブラウザー 通話

                          Twilio Client allows your website users to make and receive phone calls directly from their web browsers.

                          通話のトラッキング

                          Call Tracking helps you measure the effectiveness of your marketing campaigns.

                          これは役に立ちましたか?

                          このチュートリアルをご覧いただき、ありがとうございます。 

                          Tweet @twilio to let us know what you're building.

                          Agustin Camino Jose Oliveros Andrew Baker Paul Kamp Kat King
                          Rate this page:

                          ヘルプが必要ですか?

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