- Azure Serverless Computing Cookbook
- Praveen Kumar Sreeram
- 213字
- 2021-07-02 20:23:11
How to do it...
- Navigate to the Application settings blade of the function app and add two keys to store TwilioAccountSID and TwilioAuthToken, as shown here:

- Go the Integrate tab of the RegisterUser function and click on New Output and choose Twilio SMS, as shown in the following screenshot:

- Click on Select and provide the following values to the Twilio SMS output (objsmsmessage) bindings. From number is the one that is generated in the Twilio portal, which we discussed in the Getting Ready section of this recipe:

- Navigate to the code editor and add the following lines of code, highlighted in bold. In the preceding code, I have hard coded To number. However, in real-world scenarios, you would dynamically receive the end user's mobile number and send the SMS via code:
...
...
#r "Twilio.Api"
...
...
using Twilio;
public static void Run(HttpRequestMessage req,
TraceWriter log,
CloudTable objUserProfileTable,
out string objUserProfileQueueItem,
out Mail message,
TextWriter outputBlob,
out SMSMessage objsmsmessage
)
message.AddAttachment(objAttachment);
objsmsmessage= new SMSMessage();
objsmsmessage.Body = "Hello.. Thank you for getting
registered.";
- I just did a test run of the RegisterUser function using the request payload, shown as follows:
{
"firstname": "Praveen",
"lastname": "Sreeram",
"email":"example@gmail.com",
"ProfilePicUrl":"A Valid url here"
}
- The following is the screenshot of the SMS that I have received:

推薦閱讀
- Java語言程序設計
- Vue.js 3.x快速入門
- iOS Game Programming Cookbook
- 基于粒計算模型的圖像處理
- TensorFlow Lite移動端深度學習
- Building Modern Web Applications Using Angular
- 新手學Visual C# 2008程序設計
- Linux網絡程序設計:基于龍芯平臺
- 鋒利的SQL(第2版)
- Spring+Spring MVC+MyBatis整合開發實戰
- 軟件項目管理實用教程
- Orleans:構建高性能分布式Actor服務
- Nagios Core Administration Cookbook(Second Edition)
- Mudbox 2013 Cookbook
- Visual Basic語言程序設計基礎(第3版)