For the complete documentation index, see llms.txt. This page is also available as Markdown.

📧Python ve Twilio ile SMS server oluşturma

Twilio ile SMS server oluşturma

from flask import Flask, request, redirect
from twilio.twiml.messaging_response import MessagingResponse

app = Flask(__name__)

@app.route("/sms", methods=['POST'])
def sms_reply():
    """Respond to incoming calls with a simple text message."""
    
    # Use this data in your application logic
    from_number = request.form['From']
    to_number = request.form['To']
    body = request.form['Body']

    # Start our TwiML response
    resp = MessagingResponse()

    # Add a message
    resp.message("The Robots are coming! Head for the hills!")

    return str(resp)

if __name__ == "__main__":
    app.run(debug=True)
  • Hata reporalarını kontrol ederek takip yapabilirsiniz

  • ngrok config add-authtoken <token> ile giriş yapın, aksi halde response döndüremezsiniz

  • ngrok http 5000 ile tuneli açın

  • Active numbers alanı üzerinden Messaging kısmında A MESSAGE COMES IN alanına <tunnel>/sms

    • https://a501237-20-229-74-178.eu.ngrok.io/sms

  • Geo Location izni verin aksi halde SMS gönderemez

🚨 Türkiyeden yurt dışına SMS göndermek pahalı, twilio Turkiye numarası sunmuyor!

References

Son güncelleme

Bu yararlı oldu mu?