官术网_书友最值得收藏!

How to do it...

  1. Navigate to the Application settings blade of the function app and add two keys to store TwilioAccountSID and TwilioAuthToken, as shown here:
  1. Go the Integrate tab of the RegisterUser function and click on New Output and choose Twilio SMS, as shown in the following screenshot:
  1. 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:
  1. 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.";
  1. 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"
}
  1. The following is the screenshot of the SMS that I have received:
主站蜘蛛池模板: 宜春市| 通渭县| 佛学| 清远市| 金溪县| 文水县| 灵台县| 武汉市| 东港市| 搜索| 固始县| 贵南县| 会同县| 新平| 梧州市| 葵青区| 郯城县| 平昌县| 张家口市| 班戈县| 清河县| 林芝县| 富锦市| 哈尔滨市| 济源市| 西平县| 夏津县| 喀喇沁旗| 温宿县| 斗六市| 呼伦贝尔市| 广宁县| 湛江市| 信丰县| 耒阳市| 廉江市| 沂南县| 芦溪县| 义乌市| 怀远县| 鄂温|