This is a GitHub template for creating other Twilio sample/template apps. It contains a variety of features that should ideally be included in every Twilio sample app. You can use GitHub's repository template functionality to create a copy of this.
Implementations in other languages:
Java | Python | PHP | Ruby | Node |
---|---|---|---|---|
TBD | TBD | TBD | TBD | Done |
This application is only a barebones C# .NET Core web application built using ASP.NET Core MVC. Whenever, possible we should be using this. However, if you are using .NET Framework that comes with its own standardized application structure, you should try to merge these by using the same README
structure and test coverage, configuration etc. as this project.
- .NET Core web server using ASP.NET Core MVC
- User interface to send SMS.
- Unit tests using
xUnit
andMoq
- End to End UI testing using Selenium
- Automated CI testing using GitHub Actions
- Formatting using dotnet-format
- Project specific environment variables using a JsonConfigurationProvider to load
twilio.json
.
- Create a copy using GitHub's repository template functionality
- Update the
README.md
. - Rename the apps to your desired name and take care of the namespaces that would also require to change.
- Build your app as necessary while making sure the tests pass.
- Publish your app to GitHub
This application should give you a ready-made starting point for writing your own application. Before we begin, we need to collect all the config values we need to run the application:
Config Value | Description |
---|---|
Account Sid | Your primary Twilio account identifier - find this in the Console. |
Auth Token | Used to authenticate - just like the above, you'll find this here. |
Phone number | A Twilio phone number in E.164 format - you can get one here |
After the above requirements have been met:
- Clone this repository and
cd
into it
git clone git@github.com:twilio-labs/sample-template-dotnet.git
cd sample-template-dotnet
- Build to install the dependencies
dotnet build
- Set your environment variables
cp TwilioSampleApp/twilio.json.example TwilioSampleApp/twilio.json
See Twilio Account Settings to locate the necessary environment variables.
- Run the application
dotnet run --project TwilioSampleApp
- Navigate to http://localhost:5000
That's it!
You can run the tests locally by typing:
dotnet test
- GitHub's repository template functionality
This template is open source and welcomes contributions. All contributions are subject to our Code of Conduct.
No warranty expressed or implied. Software is as is.