Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
A sample code for docomo sebastien CGS (
#!/usr/bin/env python
import flask
from flask import Flask, request, jsonify
app = Flask(__name__)
def hello():
return "Hello World!"
@app.route('/test', methods=["POST"])
def test():
bot_id = request.json["bot_id"]
user_id = request.json["user_id"]
intent = request.json["args"]["intent"]
if intent == "test":
text = request.json["args"]["utterance"] + "。いえーい!"
talkend_flag = False
elif intent == "noun":
noun = request.json["args"]["noun"]
text = noun + "、ってなんじゃ?"
talkend_flag = False
elif intent == "goodbye":
text = ""
talkend_flag = True
responce = {"error_code": "success",
"status": "true",
"bot_id": bot_id,
"user_id": user_id,
"params": {
"status": "true",
"talkend": talkend_flag,
"message": text,
"option": {"balloon": {
"type": "text"
return jsonify(responce)
def main():'', port=8080)
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.