Package: dj-nexmo
DJ-NexmoTheNexmo APIisawesome- but there are some problems that developers using Nexmo need to solve again and again.
This Django app provides Django-specific functionality on top of theNexmo Client Library for Python! Currently it contains:A decorator for validating and re-combining SMS message parts.Template filters for rendering phone numbers in international and national formats.How To Install ItCurrently,dj-nexmoonlysupports Python 3.4+, and Django 2.0+. Wemaybackport to Django 1.x, but we have no intention of backporting to Python 2.First,pip install dj-nexmoAdd"djnexmo"toINSTALLED_APPSin your settings.Runpython manage.py migrate djnexmoto create the necessary models.ConfigurationNEXMO_API_KEYThis optional setting should be set to your Nexmo API Key, which you can obtain from the dashboard.NEXMO_API_SECRETThis optional setting should be set to your Nexmo API Secret, which you can obtain from the dashboard.NEXMO_SIGNATURE_SECRETThis optional setting should be set to your Nexmo Signature Secret, which you can obtain by contacting Nexmo support.
You will need this setting if you wish to validate incoming SMS.NEXMO_SIGNATURE_METHODThis optional setting should be set to your Nexmo signing method, which you should obtain from Nexmo support when you
obtain your Nexmo signature secret.NEXMO_APPLICATION_IDThis optional setting should be set to the ID of a Nexmo Voice application.NEXMO_PRIVATE_KEYThis optional setting should be set to your Nexmo Voice application's private key, or a path to a file containing
your private key.Using the Nexmo Clientdj-nexmoconfigures a NexmoClientobject from the settings above. You can
use it by importing it from thedjnexmopackage:fromdjnexmoimportclientclient.send_sms({'to':'447700900301','from':'447700900414','text':'Hello from DJ Nexmo!'})Incoming SMSdj-nexmoprovides a view decorator which will ensure your webhook view is only called once all the parts of an SMS are
available.# This will automatically check the signature of the incoming request.# The view will only be called once all parts of the SMS have arrived.@sms_webhookdefsms_registration(request):# Your parsed & merged SMS message will be available as `request.sms`:sms=request.sms# Don't do any long processing here - you should return a 200 response as soon as possible....returnHttpResponse("OK")Formatting Phone Numbersdj-nexmoadds a couple of template filters for formatting phone numbers, wrapping the awesomephonenumberslibrary.{% load phonenumbers %}

International: {{ "447700900486" | international }} => +44 7700 900486
Local Format: {{ "447700900486" | national }}       => 07700 900486Coming Soon:A management command for clearing the database of old message parts where not all parts were received.A decorator to validate other webhooks from the Nexmo API.LicenseThis code is open-source, released under the Apache License. This means it is free to use
for commercial or non-commercial purposes, and you can make any changes you would like or need.Contribute!We :heart: contributions -- if you'd like help contributing to this project, please contact us!
If you want to do anything particularly significant, we recommend you open up an issue
to discuss it with us first. If there's something you'd like to see, please open an issue for that
too! If you find a bug, please create an issue - any help you can give providing a small code sample that
demonstrates the problem you've seen would be very useful and means we should be able to solve
your problem sooner!