Urban Airship

SMS

Register and manage SMS channels.

Sms Channel Registration

Begin the opt-in process for a new Sms channel.

If the opted-in timestamp is not included, a channel id value will not be created. For more information see: https://docs.airship.com/api/ua/#operation/api/channels/sms/post

import urbanairship as ua
airship = ua.Airship('app_key', 'master_secret')
sms = ua.Sms(airship, sender='12345', msisdn='15035556789')

sms.register(opted_in='2018-02-13T11:58:59')
class urbanairship.devices.sms.Sms(airship, sender, msisdn, opted_in=False, template_fields=None)

Create, register, opt-out and uninstall an Sms object.

Parameters:
  • airship – Required. An urbanairship.Airship object instantiated with master authentication.
  • sender – Required. The a number that recipients will recieve SMS notifications from. This must match your Urban Airship configuration.
  • msisdn – Required. The mobile phone number you want to register as an SMS channel (or send a request to opt-in).
  • opted_in – The UTC datetime in ISO 8601 format that represents the date and time when explicit permission was received from the user to receive messages. This is required for use with CreateAndSend.
  • template_fields – For use with CreateAndSend with inline templates. A dict of template field names and their substitution values.
register(opted_in=False)

Register an Sms channel with the sender ID and MSISDN

Parameters:opted_in – Optional UTC ISO 8601 datetime string that represents the date and time when explicit permission was received from the user to receive messages.
Returns:The response object from the api.
opt_out()

mark an sms channel at opted-out by sender ID and MSISDN

Returns:the response object from the api
uninstall()

Uninstall and remove all associated data from Urban Airship systems. Channel cannot be opted-in again. Use with caution.

Returns:the response object from the api
lookup()

Look up Sms channel information

Returns:the response object from the api

SMS Channel Opt-Out

This will mark an SMS channel as opted-out (inactive). It will not receive alerts even when they are addressed in the future. To opt the user back in, call the registration function again with a valid opted_in value.

For more information, see: https://docs.airship.com/api/ua/#operation/api/channels/sms/opt-out/post

   import urbanairship as ua
   airship = ua.Airship('app_key', 'master_secret')
   sms = ua.Sms(airship, sender='12345', msisdn='15035556789')

   sms.opt_out()

.. automodule:: urbanairship.devices.sms
  :members: Sms
  :noindex:

SMS Channel Uninstall

Removes phone numbers (MSISDNs) and accompanying data from Airship. Use with caution.

Uninstalling an SMS channel will prevent you from retrieving opt-in and opt-out history for the corresponding MSISDN. If the uninstalled MSISDN opts-in again, it may generate a new channel_id.

For more information, see: https://docs.airship.com/api/ua/#operation/api/channels/sms/uninstall/post

   import urbanairship as ua
   airship = ua.Airship('app_key', 'master_secret')
   sms = ua.Sms(airship, sender='12345', msisdn='15035556789')

   sms.uninstall()

.. automodule:: urbanairship.devices.sms
  :members: Sms
  :noindex:

SMS Channel Lookup

Look up information on an SMS channel by sender and MSISDN.

   import urbanairship as ua
   airship = ua.Airship('app_key', 'master_secret')
   sms = ua.Sms(airship, sender='12345', msisdn='15035556789')

   channel_info = sms.lookup()

.. automodule:: urbanairship.devices.sms
  :members: Sms
  :noindex:

Apple, StoreKit and iPhone are trademarks of Apple, Inc. Maponics Neighborhood Boundaries © Maponics 2012. DMA® is a registered service mark of The Nielsen Company. Used under License.