PythonおよびFlaskによるインスタント引き合いアラート
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 to send a message when a new lead is found for a Python and Flask application.
架空の不動産会社向けのインスタント引き合いアラートを実装します。
We'll create a landing page for a new house on the market and notify a real estate agent instantly when a potential customer requests information.
Porchが住宅の建設業者に新規プロジェクトに選定されたときに即時アラートを送信するためにTwilio SMSを使用する方法についてご紹介します。
Let's see how it works! Click the below button to begin.
ランディングページを入力する
住宅用のランディングページを表示するには、顧客がそれを自分に合っているか検討できるよう、まずデータをいくつか追加することが必要です。
デモ用に、必要な情報を含むディクショナリーをハードコード化しました。
続いて、ページをレンダリングする方法を見てみましょう。
Render a Landing Page
In our template we insert data about the house and in a sidebar we'll include a form for our home-shopping user.
Here an interested shopper would enter their contact information to request more info about the home.
続いて、、後で使用するTwilioクライアントの初期化方法を確認しましょう。
Initialize the Twilio REST API Client
ここでは、テキストメッセージの送信時には常に必要な、認証済みの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:
続いて、引き合いがやってきたときにそれを処理する方法を見てみましょう。
POSTリクエストを処理する
This code handles the HTTP POST
request triggered by the user from our landing page.
このコードでは、TwilioService
クラスを使用して SMS メッセージを不動産担当者の電話番号に送信します。その電話番号は環境変数としても設定されます。 引き合いの名前、電話番号、そして問い合わせ内容は販売員に送信されるテキスト・メッセージの本文に直接含まれます。
これで、担当者は引き合いに追加で連絡を行うのに必要な情報をすべて入手しました。
一丁あがり! テキスト・メッセージを使用して即座に見込み顧客を即座に営業担当者に引き合わせられるアプリケーションを実装しました。
続いて、アプリケーションに追加する他の簡単な機能をいくつかみておきましょう。
次はどこでしょうか?
Twilioには、Python大好き人間がいっぱいいます - 僕たちの書いた他のPythonチュートリアルもぜひご覧ください:
TwilioでWebアプリケーションへの予約リマインダーの実装について学んで、すっぽかしを削減しましょう。
Twilio 対応 Authy を使って Web アプリに二要素認証(2FA)を実装する方法を学びます。
これは役に立ちましたか?
Thanks for checking out this tutorial! Let us know what you've built - or what you're building - on Twitter.
ヘルプが必要ですか?
誰しもが一度は考える「コーディングって難しい」。そんな時は、お問い合わせフォームから質問してください。 または、Stack Overflow でTwilioタグのついた情報から欲しいものを探してみましょう。