2016-04-02 5 views
0

コードは以下の通りです。これは、Ubuntuを実行しているaws ec2サーバー上で動作します。これはPythonコードです。私はテキストでコンソールに応答します: - [02/Apr/2016 15:27:56] "POST/HTTP/1.1" 404 -Twillio Textレスポンスは返信しません

これをどうすれば解決できますか?ありがとう。ここ

from flask import Flask, request, redirect 
 
import twilio.twiml 
 
from twilio.rest import TwilioRestClient 
 

 

 

 
app = Flask(__name__) 
 

 
if __name__ == '__main__': 
 
    app.run(host='0.0.0.0', debug = False) 
 

 
@app.route('/text/<text>', methods=['GET', 'POST']) 
 
def text(text): 
 
    """Respond to incoming calls with a simple text message.""" 
 

 

 
    response = twiml.Response() 
 
    response.message("Hello, Mobile Monkey") 
 
    return str(resp) 
 

 
if __name__ == "__main__": 
 
    app.run(debug=True)

+0

twilioの設定を確認する必要があります –

+0

Twilioは '/ text/ 'に投稿していないので、@daniilが言ったようにTwilioの設定を確認して投稿の場所を確認してください – Max

答えて

0

Twilioの開発者エバンジェリスト。

あなたのTwilio番号が/にPOSTの新しいメッセージに設定されているように見えますが、あなたのルートは/text/<text>に設定されています。

あなたはいくつかの変更が必要です。まず、Twilioは<text>のようなURLパラメータを設定しないので、あなたのルートからそれを削除することができます。

@app.route('/text', methods=['GET', 'POST']) 
def text(text): 
    """Respond to incoming calls with a simple text message.""" 


    response = twiml.Response() 
    response.message("Hello, Mobile Monkey") 
    return str(resp) 

次に、あなたは/textであなたのnumber configurationように、メッセージングURLのポイントを変更したいと思います。

これをチェックアウトするquickstart guide for a bit more information on sending SMS messages in Python

それがまったく役に立ったら教えてください。

関連する問題