- 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:

推薦閱讀
- Testing with JUnit
- 深度強化學習算法與實踐:基于PyTorch的實現
- C#程序設計基礎:教程、實驗、習題
- Java EE 8 Application Development
- Java EE核心技術與應用
- Julia高性能科學計算(第2版)
- C# and .NET Core Test Driven Development
- Android應用開發深入學習實錄
- FFmpeg開發實戰:從零基礎到短視頻上線
- C++程序設計教程(第2版)
- Developer,Advocate!
- Java Script從入門到精通(第5版)
- 前端程序員面試算法寶典
- 前端程序員面試筆試真題與解析
- Building E-Commerce Solutions with WooCommerce(Second Edition)