Skip to main content

Django Anexia SMS Gateway

PyPI Test Status Codecov

A django module to send short messages via the Anexia SMS gateway (ASGW). It requires an active Anexia Engine subscription and a "ready to use" configured " sender" within your web service.

Installation

Install using pip:

pip install django-anexia-sms-gateway

In the project's settings.py add the access token configuration:

# Anexia SMS Gateway settings (ASGW)
ASGW_ACTIVE = True
ASGW_API_TOKEN = "your-asgw-api-token"

Usage

Call the send_sms method wherever you want to trigger a short message:

from django_anexia_sms_gateway.sms import send_sms

send_sms(message="SMS content", destination="+43123456789")

Translation (message)

If you provide a translatable message string be sure to use ugettext ("gettext_lazy" would not be triggered on time):

from django.utils.translation import ugettext
from django_anexia_sms_gateway.sms import send_sms

send_sms(message=ugettext("Translatable SMS content"), destination="+43123456789")

Recipient phone number (destination)

The recipient's phone number (=destination) must consist of prefix + followed by 1 to 14 digits. Otherwise the ASGW API will return an error.

Phone number on model

In case you store the phone number on a model (e.g. User), we recommend direct validation via RegexValidator, e.g.:

from django.core.validators import RegexValidator
from django.db.models import CharField
from django.utils.translation import gettext_lazy as _

phone = CharField(
    _("phone number"),
    max_length=15,
    blank=True,
    help_text=_("Prefix '+' followed by 1-14 digits, e.g. '+436641234'"),
    validators=[
        RegexValidator(
            r"^\+\d{1,14}$",
            _("Phone number must be entered in the format: '+123456789'. Prefix '+' with 1 to 14 digits allowed."),
        )
    ],
)

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_anexia_sms_gateway-1.2.0.tar.gz (9.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_anexia_sms_gateway-1.2.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file django_anexia_sms_gateway-1.2.0.tar.gz.

File metadata

File hashes

Hashes for django_anexia_sms_gateway-1.2.0.tar.gz
Algorithm Hash digest
SHA256 f136c579dc62aa55de1b9402db00949e11aeef6146e29db01628646143072d3a
MD5 c1948c8b0fcffba1447e230b7543fd09
BLAKE2b-256 d4cdd269918c3c495e11ff3545c1df23893d9833704bcdfcbd23accd17a210ab

See more details on using hashes here.

File details

Details for the file django_anexia_sms_gateway-1.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_anexia_sms_gateway-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3c4ea0d55772beb5f93f3903704e94f689815d7a3989b82c95120d5026a6e6c7
MD5 7768f8bb4a538a6b59939b6200d20f1b
BLAKE2b-256 50bffec90fa441ede24e4e5816029726f69fa0a4f9eaadf866c6ec721da6962b

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.2.0 This release

2 files

1.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page