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

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:
主站蜘蛛池模板: 西充县| 桂阳县| 寻乌县| 阿瓦提县| 闽清县| 亳州市| 大同县| 海盐县| 阳朔县| 北海市| 中山市| 大洼县| 常州市| 锡林郭勒盟| 罗定市| 漯河市| 兴和县| 朔州市| 璧山县| 茌平县| 太白县| 富裕县| 长武县| 乌鲁木齐县| 徐闻县| 澜沧| 闻喜县| 余庆县| 阿尔山市| 嘉鱼县| 安图县| 邹平县| 兰州市| 神农架林区| 油尖旺区| 芮城县| 麦盖提县| 林甸县| 梨树县| 辽宁省| 灌南县|