Experiencing SMS send failures? What customers need to know about TCR/ SMS registration requirements...
SMS in asp.net web application
using System;using System.Web;using System.Web.UI;using System.Threading.Tasks;using RingCentral;using System.Web.UI.WebControls;namespace RingCentral_SMS{ public partial class Default : System.Web.UI.Page { RestClient rc = null; const string RINGCENTRAL_CLIENTID = "Your_App_Client_Id"; const string RINGCENTRAL_CLIENTSECRET = "Your_App_Client_Secret"; const string RINGCENTRAL_USERNAME = "Your_Username"; const string RINGCENTRAL_PASSWORD = "Your_Password"; const string RINGCENTRAL_EXTENSION = "ExtensionNumber"; protected void sendMessageButton_Clicked(object sender, EventArgs e) { LoginRingCentralAsync().Wait(); } private async Task LoginRingCentralAsync() { if (rc == null) { rc = new RestClient(RINGCENTRAL_CLIENTID, RINGCENTRAL_CLIENTSECRET, false); await rc.Authorize(RINGCENTRAL_USERNAME, RINGCENTRAL_EXTENSION, RINGCENTRAL_PASSWORD); if (rc.token.access_token.Length > 0) { result.InnerHtml = "Authorized"; SendMessageAsync().Wait(); } else { result.InnerHtml = "Unauthorized"; } } } private async Task SendMessageAsync() { var parameters = new CreateSMSMessage(); parameters.from = new MessageStoreCallerInfoRequest { phoneNumber = sendFrom.Value }; parameters.to = new MessageStoreCallerInfoRequest[] { new MessageStoreCallerInfoRequest { phoneNumber = sendTo.Value } }; parameters.text = subject.Value; var resp = await rc.Restapi().Account().Extension().Sms().Post(parameters); result.InnerHtml = resp.messageStatus; } } }
<%@ Page Language="C#" Inherits="RingCentral_SMS.Default" %><!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title>RingCentral Connect Platform Demo</title></head><body> <h2>RingCentral APIs Demo</h2> <form id="form2" method="post" enctype="multipart/form-data" runat="server"> <div> <h3>Messaging Demo</h3> <span>From</span> <input type="text" id="sendFrom" name="text" size="20" runat="server"/> <br/> <span>To</span> <input type="text" id="sendTo" name="text" size="20" runat="server"/> <br/> <span>Text message</span> <input type="text" id="subject" name="text" size="100" runat="server"/> <br/> <asp:Button ID="Button2" Text="Send" runat="server" onClick="sendMessageButton_Clicked"/> </div> </form> <br/> <div>Result:</div> <div id="result" runat="server" /></body></html>
2 likes
1 like
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
Sorry, we're still checking this file's contents to make sure it's safe to download. Please try again in a few minutes.
Sorry, our virus scanner detected that this file isn't safe to download.
We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.
We use 3 different kinds of cookies. You can choose which cookies you want to accept. We need basic cookies to make this site work, therefore these are the minimum you can select. Learn more about our cookies.