Showing posts with label Twillo SMS. Show all posts
Showing posts with label Twillo SMS. Show all posts

Sunday, January 14, 2018

How to send Twillo SMS from Azure function

Step 1 : "Twilio": "5.9.0" Add this library in your function project.json file of azure function

Step 2 : #r "Twilio.Api" for import twillo library add this line in your run.csx file of azure function

Step 3 : using Twilio; add this for use twillo code

Step 4 :


string accountSid = "YourAccountSID";
string authToken = "YourAccountAuth";
 
Step 5 : Create class for return response 


public class OutResponse
{
public string ID {get;set;}
public string Status {get;set;}
public string MobileNo {get;set;}
public string DBID {get;set;}
}
 
Step 6 : Twillo SMS Send Code
 

OutResponse mytempList = new OutResponse();

 var client = new TwilioRestClient(accountSid, authToken);
      
 var message=client.SendMessage(
            
  FromNo "Get From Twillo Panel",
  myQueueItem.SendToMobileNo,
  myQueueItem.SMSText
 );

 mytempList.ID = message.Sid;
 mytempList.Status = message.Status;

 mytempList.MobileNo = message.To;

 mytempList.DBID = myQueueItem.EmailBody;