Reputation: 49
I can't send multiple reply to single number.
It got 1 reply together 2 messages.
"How are you?I'm here to help you."
from flask import Flask, request, render_template
from twilio.twiml.messaging_response import MessagingResponse
app = Flask(__name__)
@app.route('/bot', methods=['POST'])
def bot():
incoming_msg = request.values.get('Body', '').lower()
resp = MessagingResponse()
msg = resp.message()
responded = False
if 'Hi' in incoming_msg:
response = "How are you?"
msg.body(response)
response2 = "I'm here to help you."
msg.body(response2)
responded = True
if not responded:
msg.body('BYE')
return str(resp)
if __name__ == '__main__':
app.run()
Upvotes: 0
Views: 234
Reputation: 4857
Twilio messages with multiple <Body>
nouns will be concatenated, see the documentation:
The text of the message you want to send. Must be less than 1600 characters. If more than one
<Body>
element is used in a single<Message>
the contents of the two will be concatenated together into a single Body value.
I.e. with MessagingResponse
you can only send a single reply. If you really want to send multiple replies you'll need to create the first one with client.messages.create(...)
and return the second one via your webhook.
Upvotes: 1