With the amount of noise in social media and e-mail inboxes, it's hard to make a meaningful connection with your customers or audience. SMS text and/or MMS picture messages, however, are a personal communication channel with an open rate above 95%, which make them a great choice for social communication.
In this tutorial, you will learn how to enable your users to opt-in for an SMS marketing campaign using their mobile phone.
-
First clone this repository and
cd
into it.git clone git@github.com:TwilioDevEd/marketing-notifications-csharp.git cd marketing-notifications-csharp
-
Rename the file
MarketingNotifications.Web/Local.config.example
toMarketingNotifications.Web/Local.config
and update the content.You can find your
TWILIO_ACCOUNT_SID
andTWILIO_AUTH_TOKEN
in your Twilio Account Settings. You will also need aTWILIO_NUMBER
, which you may find here. -
Build the solution.
-
Run
Update-Database
at Package Manager Console to execute the migrations.Be sure to ckeck SQLServer 2019 (with LocalDB support) is up and running and the server name matches the one from the connection string on
MarketingNotifications.web/Web.config
. -
Run the application.
-
Expose application to the wider internet. To start using
ngrok
on our project you'll have to execute the following line in the command promptngrok http 1086 -host-header="localhost:1086"
Keep in mind that our endpoint is:
http://<your-ngrok-subdomain>.ngrok.io/Subscribers/Register
-
Configure your Twilio number.
Go to your dashboard on Twilio. Click on Twilio Numbers and choose a number to setup. On the phone number page enter the address provided by ngrok into the Messaging Request URL field.
- Wrap Up!
By now your application should be up and running at http://localhost:1086/. Now your subscribers will be able to text your new Twilio number to subscribe to your Marketing Notifications service.
To subscribe, just send any message to your configured Twilio phone number and it will reply with a text.
- No warranty expressed or implied. Software is as is. Diggity.
- MIT License
- Lovingly crafted by Twilio Developer Education.