Instead of linking to your credentials with api = VoximplantAPI(credentials.json), you can also use the VOXIMPLANT_CREDENTIALS environment variable: export VOXIMPLANT_CREDENTIALS=/Users/demo/voximplant_python_sms/c23057e8-35be-KEEP_THIS_SECURE_private.json Receiving SMS SOURCE = "14388002812" # Enter your Voximplant phone number here import sysįrom voximplant.apiclient import VoximplantAPI, VoximplantExceptionĪpi = VoximplantAPI("c23057e8-35be-KEEP_THIS_SECURE_private.json") Now let’s make a simple Python application where you specify the destination number and message as command line parameters using your favorite editor. Python -m pip install -user voximplant-apiclient Python script Go to your project folder and install the SDK using: You will need setuptools >= 18.5 installed. Voximplant’s Python API Client Library works with both Python 2.x and 3.x. See here for more on integrating with Voximplant’s API clients. We will use Python in this example, but you can follow a similar procedure for any of Voximplant’s other API client libraries - node.js, php. See more on choosing an SMS number and even doing that programmatically here. Now edit that number, and click the enable SMS slider and save: Note Voximplant also offers free test numbers, but these will not work with the SMS service. You’ll need to select one or more real numbers and click Buy.Īfter you’ve bought a number, you'll immediately see this number on the list. The phone number interface will be displayed. On the Voximplant control panel, select My phone numbers from the menu on the left and then select Buy new phone number in the upper right corner. Voximplant let’s you choose one from nearly 60 countries. You will need to have a phone number to send an SMS. See here for more information on Voximplant’s service accounts. This example assumes you have it in the same folder as your main Python SMS app. You will need to delete the key and repeat this procedure to create a new one if you lose it or want to change the credentials. Keep this file secure - it gives access to your Voximplant account. Click Generate Key and you will be asked to save a JSON file with your credentials. You can optionally limit the role of the service account and give it a description. Then head to the Service Accounts section inside settings from the menu on the left. If you don’t have a Voximplant account, you can sign-up for one at. Local telecom carriers charge money to terminate SMS and spammers can abuse the system, so you will need some credentials before you are allowed to send a message. In this tutorial we will show how to make a simple command line application that lets you send a message of your choice to any SMS enabled number. Using the Voximplant platform, you just need to setup some credentials, pick a phone number, and use a simple API command. Sending an SMS message from Python is simple.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |