Since the release of .NET Core 1.0 in 2014, .NET developers have no longer been confined to development on Windows. Yet I am still surprised by how many people don't realise that .NET Core is cross-platform!
- Popular free Alternatives to Twilio for Web, Windows, Mac, Linux, Software as a Service (SaaS) and more. Explore 18 websites and apps like Twilio, all suggested and ranked by the AlternativeTo user community.
- Download Twilio's demo chat client to get started. Follow the associated readme file which will direct you on how to add in the correct credentials. Check to see if you have node.js installed by running npm install in Git Bash (Windows) or your terminal window (Linux/Mac) Run ‘npm start’ in your terminal window.
- Download twilio setup:https://drive.google.com/file/d/1BwfcK3PLvDOcfrSbra8Yd5QOAIiTCyh/view.
I develop all my .NET code, from web apps to Azure Functions, on macOS and with SQL server being a large part of developing with .NET, I wanted to share how I use it on macOS.
Twilio simplifies worldwide connectivity with cloud-based communications APIs and SDKs for SMS, Voice & Messaging apps. Software developers can use the tools.
![How To Download Twilio On Mac How To Download Twilio On Mac](/uploads/1/2/6/7/126731356/516726298.jpg)
We will use a Docker container to host SQL server, which means this technique could also be used on Windows and Linux and not just macOS.
If you would like to see a full integration of Twilio APIs in a .NET Core application then checkout this free 5-part video series I created. It's separate from this blog post tutorial but will give you a full run down of many APIs at once.
Getting Started with Docker
To get started we will need to download Docker for Mac and follow the installation instructions.
Once installed, the first thing we will need to do is increase Docker's default memory allocation as SQL Server will require a bit more grunt.
Click on the Docker daemon icon in the top menu and select 'Preferences'.
Next, choose the 'Resources' tab, note - on some versions of Docker you may find it under the 'Advanced' tab, and adjust the memory slider to be at least 4GB. Then click 'Apply and Restart'
Downloading and running SQL Server
We can download and run the SQL Server image all at once by running the following command in the terminal.
There are several parameters in the above command, so let's take a closer look at each one.
-d
will launch the container in 'detached' mode and is optional. This means that containers will run in the background and you can close the terminal window.--name sql_server
will assign a name to the container and is optional, but recommended for easier management!-e
will allow you to set environment variables:'ACCEPT_EULA=Y'
SQL Server requires the user to accept the 'End User Licence Agreement' or EULA. TheY
here indicates acceptance.'SA_PASSWORD=someThingComplicated1234'
is a required parameter for SQL Server. This is the System Administrator password. See the note below on password strength.
-p 1433:1433
will map the local port 1433 to port 1433 on the container. Port 1433 is the default TCP port that SQL Server will listen on.- mcr.microsoft.com/mssql/server:2019-latest is the image we wish to run. I have used the latest version of 2019, however, if you need a different version you can check out the Microsoft SQL Server page on Docker Hub.
For more information on docker runcommands, check out the documentation.
Note on Password Strength
If you find your image starts but then immediately stops or you get an error such as setup failed with error code 1`, then it may be you haven't created a strong enough password. SQL Server really means it when it requests a strong password. Ensure good length with a mixture of upper and lower case, and a mix of alphanumeric characters. For more information on password requirements take a look at the Microsoft documentation.
Using the SQL CLI tool
The SQL CLI tool is a convenient command-line tool for querying SQL databases and is cross-platform. It's also really useful for checking to see if the above worked!
To install it, run the following command in the terminal:
Where
someThingComplicated1234
is your password.You should receive a response similar to below:
Azure Data Studio
Another hurdle with using SQL Server on macOS is the lack of SQL Server Management Studio (SSMS), a software tool that is used for configuring, managing, and administering all components within Microsoft SQL Server. It includes scripting tools for creating and running queries and graphical tools for use with objects and features within SQL Server.
However, Azure Data Studio has got you covered.
Click the 'New connection' link and enter
localhost
for the 'Server' input, sa
for the 'User name' input, and then your password for the 'Password' input.The other inputs are optional.
![Twilio trial Twilio trial](/uploads/1/2/6/7/126731356/972111243.jpg)
Once you've logged in you should have a view similar to the one below, with all the databases on the server listed.
The connection string
To use the database within code, the connection string will look like this, with the database name substituted for
DB_NAME
.Some useful Docker commands
Some useful Docker commands can be found below
- View downloaded images:
docker images
- View all containers:
docker container ls -a
- View all running containers:
docker container ls -a
- Start a container:
docker start CONTAINER_NAME
- Stop a container:
docker stop CONTAINER_NAME
- Remove a container:
docker rm CONTAINER_ID
How To Use Twilio Python
Cross platform-ness
Although I have targeted everything in this blog towards macOS, there is no reason why you couldn't run your SQL Server instance within Docker on Windows or Linux.
If you have any tips and tricks for cross-platform development with .NET Core, then I would love to hear from you!
- Email: [email protected]
- Twitter: @LaylaCodesIt
- GitHub: layla-p
- Twitch: LaylaCodesIt
You are viewing an outdated version of this SDK.
The Twilio Python Helper Library makes it easy to interact with the Twilio API from your Python application. The most recent version of the library can be found on PyPi. The Twilio Python Helper Library supports Python applications written in Python 2.7 and above. If you are interested in migrating to the newer 6.x version of the Twilio Python Helper Library from the 5.x version, check out this guide.
Install the Library
The easiest way to install the library is from PyPi using pip, a package manager for Python. Simply run this in the terminal:
If you get a
pip: command not found
error, you can also use easy_install
. Run this in your terminal:Manual Installation
Or, you can download the source code (ZIP) for
twilio-python
, and then install the library by running:in the folder containing the twilio-python library.
'Permission Denied'
If the command line gives you a big long error message that says Permission Denied in the middle of it, try running the above commands with
sudo
(e.g. sudo pip install twilio
).Test Your Installation
Try sending yourself an SMS message. Save the code sample on this page to your computer with a text editor. Be sure to update the
account_sid
, auth_token
, and from_
phone number with values from your Twilio account. The to
phone number can be your own mobile phone.Save the file as
send_sms.py
. In the terminal, cd
to the directory containing the file you just saved then run:You should receive the text message on your phone.
Using this Library
Authenticate Client
Create a New Record
Get Existing Record
Twilio Free Api
Iterate Through Records
More Documentation
Once you're up and running with the Python helper library, you'll find code samples using the latest version in our REST API docs and in the documentation for every Twilio product. You can also find auto-generated library docs for the latest SDK here.
Accessing the 5.x Version of the Helper Library
Deprecation notice
New functionality will only be added to the new library (Python Helper Library 6.x). The old library (5.x) is no longer supported: Twilio will not provide bug fixes and Support might ask you to upgrade before debugging issues. Learn how to migrate your existing application.
The most recent version of the Python Helper Library is not API compatible with the previous 5.x version you may have used in previous Twilio applications. The older version will continue to work, and you will continue to find sample code for this version throughout our documentation. Should you need to install this version you can do so with the following command:
Twilio Website
Getting Help
We'd love to hear your feedback on the Twilio Python Helper Library and help you past any issues you may encounter. Feel free to drop us a line, and we'll make sure to get you sorted!
Twilio Library
Need some help?
What Is Twilio
We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd browsing the Twilio tag on Stack Overflow.