Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ade2ca7

Browse files
Merge pull request #124 from AnishKr91620/patch-3
Create building whatsapp boot in python
2 parents b57f8e3 + a83b808 commit ade2ca7

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

‎whatsapp boot in python

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Required Libraries: twilio, flask
2+
3+
from flask import Flask, request
4+
from twilio.twiml.messaging_response import MessagingResponse
5+
6+
app = Flask(__name__)
7+
8+
@app.route("/bot", methods=['POST'])
9+
def bot():
10+
incoming_msg = request.values.get('Body', '').lower()
11+
resp = MessagingResponse()
12+
msg = resp.message()
13+
responded = False
14+
15+
if 'hello' in incoming_msg:
16+
msg.body('Hello! How can I assist you today?')
17+
responded = True
18+
19+
if 'help' in incoming_msg:
20+
msg.body('Sure, how can I help you?')
21+
responded = True
22+
23+
if not responded:
24+
msg.body('Sorry, I didn\'t get that. Can you please clarify?')
25+
26+
return str(resp)
27+
28+
if __name__ == "__main__":
29+
app.run(debug=True)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /