Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
# minimal example of linking RiveScript to Twilio (untested)
from flask import Flask, request, redirect
from rivescript import RiveScript
import twilio.twiml
app = Flask(__name__)
bot = RiveScript()
@app.route("/", methods=['GET', 'POST'])
def reply():
"""Get a reply for the twilio user."""
from_number = request.values.get('From', None)
message = request.values.get('Body', None)
if message:
reply = bot.reply(from_number, message)
resp = twilio.twiml.Response()
return str(resp)
if __name__ == "__main__":
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.