Skip to content

Latest commit

 

History

History
71 lines (48 loc) · 2.06 KB

README.md

File metadata and controls

71 lines (48 loc) · 2.06 KB

Django SMS Toolkit

Django module to send and store SMS with Twilio.

It is useful to read this before implementing any project involving phone numbers.

Releases

To release a new version via github.com, follow the steps in this link.

To release a new version via git commands, follow this documentation.

You can see the releases here.

Versioning

You can refer here for semantics of versioning.

Installation

  1. pip install django-sms-toolkit.

  2. Add django_sms_toolkit to the INSTALLED_APPS in the settings file.

  3. Configure settings.

DJANGO_SMS_TOOLKIT_SETTINGS = {
    "SEND_SMS": True,  # True by default.
    "DEFAULT_FROM_NUMBER": "",
    "TWILIO": {
        "ACCOUNT_SID": "",
        "AUTH_TOKEN": "",
        "STATUS_CALLBACK_BASE_URL": "https://www.myapp.com",
        "TRIM_LONG_BODY": True,  # True by default. Makes sure character limit is not exceeded.
    }
}
  1. python manage.py migrate

  2. Include urls to be able to receive message status callbacks from Twilio.

urlpatterns = [
    ....,
    url(r'^', include('django_sms_toolkit.urls')),
]
  1. (Optional) Add TwilioMessageMixin to your auth user model.
from django_sms_toolkit.models import TwilioMessageMixin

class AuthUser(TwilioMessageMixin,...):
    ....
    
# Default from number provided in settings is used if from_number is not provided.
user.send_sms(body, from_number=None)
# OR
from django_sms_toolkit.tasks import send_sms
send_sms.delay(from_number, to_number, body, recipient_id=None)

Support

Please open an issue for support.

Contributing

Please contribute using Github Flow. Create a branch, add commits, and open a pull request.