Send SMS using Twillio in Asp.Net

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
friends welcome back to code tonight in today's video we will see how to send messages on your mobile phone using twilio in asp.net okay so what we have here is a asp.net application and we will just set up our twilio account first and then we will send sms using that video account so guys what you have to do is you have to go to google and search it will you so first step is creating a account so we will just click on right video free here okay so now you can see that we have to fill some details so we will just fill the data and then you have to enter the email so i will enter my email and then we have to enter a password now remember that will you passwords are a little complicated as there are many conditions that you have to fulfill okay so i have and added some password and i just pasted that there and i just accept the terms and we just start our trial so now it will send a email on your gmail account that you just entered and you have to verify and that make okay so i will just open up my email okay [Music] so you can actually wait for few seconds if you don't receive the email and you can also resend if it takes a lot of time for the email so i have got the email you cannot see that on the screen but i am just verifying that and okay so verifying email will take us to a screen that i will just show here okay so this is the email and here it is asking for the mobile number so i will enter my mobile number okay i will remove the additional plus 91 because that is already there so we will just verify this is to verify your mobile number okay so now it will send you a verification code that you have to enter [Music] so you can wait for some seconds until you get the verification code okay so i have received my verification code and i will just enter that and submit you can change phone number there if you want but for now we will just use the same okay so now here it is asking about which product we want to use and because we want to send the sms only so we will select the sms here okay now it is asking for a plan so we will just select alert and notification here you have to select what kind of code you need and we will just select the code option there and then it will ask us to select the language we will select the c shape over there and now the last option is we have to select the first one yes host my code on video so just remember these options that i have selected and once you select those then we will just click on get started with twilio so initially it will allow us to send a few trial messages okay so you can see it is showing 15 over there so that much amount they have initially provided us and we can use that to test our messaging services over there okay so we will just press next and next okay we will click on done now what you have to get is you have to get these two things over here okay so these two are the uh okay before that what you have to do is you have to get it you have to click on this get it with your phone number so clicking on that they will just create a random phone number and you will see that phone number down there so basically this phone number is the number with from where you will send the message and the message will be received on the phone number you will enter okay so this is the sender phone number so you have to keep that remember and you will need these two things account as id and account token so we will copy those and we will just go to our code and in the settings file i have added the keys so i will just replace the keys here i will copy the token also i will also in that tell you about where you can get this code okay so you can replace your account sid and auth token there okay so now we will need a phone number letter okay so now talking about that value code what we have is a we have one sms controller here okay so on this controller we have created one api that we will hit from postman and then we will try to send the message to the phone number that we will enter so here you will see that we are sending three values from the model here one is the two and from phone number and then there is the message okay so you have to use the same code and the values we will be sending using the first one so i will also show off the postman so this is the postman that we have and here you can see we have entered to from and message now this rom number should be the one that you see here so i will copy that one and enter in the postman now one thing you have to remember here is that you have to always add the country codes with the phone number only then it will send the sms to the right place okay so this is the api path you can get your api path okay so this is just that and on the code part what we have here is a it with your last client okay so again i will provide you this code so don't worry about that so we have this created over here and you will just see okay so this is provided by twilio this interface is provided video and we are using that and here we are just picking up the account id and the token from the app setting and we are setting to the headers and and these all things you will get with the code so don't worry about that and now what you have to do is you have to go to startup see yes this is the dot net core 6.0 so in this we have this program not here so here we have to register our interface and our class here so once you register your service there then you will be able to use that video now we will just run the application and we will go on the um postman and here i also have my phone connected so you will see the message here once we will receive the message okay so again i will just change the message like i will add here youtube okay so now i have also added one debugger over to the api so we will just hit that one and now click on okay so it is still running so you just have to wait a little okay guys so you can see the port is seven zero two nine and the same i have entered in the postman okay so now it is a post request and you will select the json body and you will add this parameter now clicking on send okay now it will get there and we will just click on continue and we are getting here it will set up the client okay it will get back to and from value now it will just send the message okay so you can see it has sent the message so now we will see if we have received that message okay so again we have our phone here so you can see the message here sent from your twilio trial sample message okay so this is something else but we will go back so this is the message you can see sent from your with your trial account it is saying sample message youtube now this is the same message that we have here okay so you can see that message is getting sent now one thing i want to explain here is that um with the trial account you cannot send a message to messages to random phone number okay so for example if you have some other phone number and you want to send the message okay then it will not send the message that way what you have to do is you have to go to your twilio account and there you have to click on phone numbers over there okay no not on phone numbers but you can click on this calls to verified phone number once you click on verified phone numbers it will open up a window okay so there you have to add your phone number on which you want to send the message okay so the numbers which will be added there will only be available for sending messages so this is one phone number i already have added and i will add a new one okay so you can select your country there you can set up your phone number here okay so you can add a simple phone number here and extension means by country code over there now you will select the sms part and click on verify number then it will send you a code on that phone number and then it will be added here and you will be able to send the message in that case okay so that is what you have to remember while trying with new accounts but if you have same phone number that is used for creating the account then you don't have to do anything you can use that phone number um without any issue so now talking about the code part how you will get the code is you have to go to go tonight.com you can open up the website and we will also provide you a direct link so don't you worry about that so here you will see the blog using dependency injection with value sms and asp.net core 6.0 so we will just click on that and here you will see this download attachment button over there you have to click on that button okay you can subscribe the channel if you want and you can help us out and in case you don't want any of those then you can still click on continue with downloading so there is no restriction on that so once you click on downloading then your zip code will start downloading okay so you can open up that file and you just have to go to web settings and replace the credentials and then you will be able to use your code okay so no issues about that and if you still face any issue then you can simply comment on the video so thanks for watching guys
Info
Channel: Code2Night
Views: 8,971
Rating: undefined out of 5
Keywords: asp.net core, Twilllio, c#, Send SMS, SMS using Twillio
Id: D4Si3KyWrvg
Channel Id: undefined
Length: 12min 34sec (754 seconds)
Published: Tue Aug 30 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.