

Next, you need to handle the incoming messages in your code. It will send you messages to the application. Now, use Clickatell's web interface and register the following URL. It uses Flask framework, and you'll need to run a Flask application in order to receive SMS messages: from flask import Flaskīp = gateway.receiver_blueprint_for('main') # SMS receiverĪpp.register_blueprint(bp, url_prefix='/sms/main') # register it with Flask In order to receive messages, you will use the same Gateway object and ask it to generate an HTTP API endpointįor you. send ( OutgoingMessage ( '+123456789', 'hi there!' )) Receiving Messages Now, let's send a message: from smsframework import OutgoingMessage gateway. (If you have multiple providers, Gateway supports routing: rules that select which provider to use). The first provider defined becomes the default one. add_provider ( 'main', ClickatellProvider ) # the default one You can add it to the Gateway and configure it to send your messages through a provider: from smsframework_clickatell import ClickatellProvider gateway.
Python send sms install#
However, if you install a provider - a library that implements some SMS service. In order to send a message, you will use a Gateway: from smsframework import Gateway gateway = Gateway ()īy itself, it cannot do anything.

Gateway.receiver_blueprints_register(app, prefix='/'):flask.Flask.

Gateway.receiver_blueprints():(name, flask.Blueprint)*.Gateway.receiver_blueprint_for(name): flask.Blueprint.Gateway.add_provider(name, Provider, **config):IProvider.Providers use Flask microframework for message receivers (not required).Supports provider APIs (like getting the balance).Synchronous message receipt through events.Handle multiple pluggable providers with a single gateway.
