Learn how to quickly send SMS messages in a Python application with the Sinch SMS API.
- Open a command prompt or terminal to the local repository folder.
- Execute the following command:
pip install sinch
In order to initialize a client using this SDK, you'll need three pieces of information:
- Your Project ID
- An access key ID
- An access key Secret
Now you can start setting up your application.
send-sms.pyand paste the provided "Send an SMS message" code into the file.
Send an SMS message
from sinch import Client sinch_client = Client( key_id="YOUR_key_id", key_secret="YOUR_key_secret", project_id="YOUR_project_id" ) send_batch_response = sinch_client.sms.batches.send( body="Hello from Sinch!", to=["YOUR_to_number"], from_="YOUR_Sinch_number", delivery_report="none" ) print(send_batch_response)
- Assign your values to the following parameters:
Parameter Your value
Find your access key on your Sinch dashboard.
Find your access secret on your Sinch dashboard. Note: Access secrets are only available during initial key creation.
Find your project ID on your Sinch dashboard.
Any number you've assigned to your Sinch account. Find the number on your Customer Dashboard by clicking the service plan ID link and scrolling to the bottom of the page.
The phone number to which you want to send the test SMS message.
- Save the file.
Now you can execute the code and send your test SMS message. Run the following command:
send-sms.pyfile uses the Sinch SDK
batchesendpoint to send the SMS message. Click here to read more about the
- Visit our API specification to test more endpoints.