protected void Page_Load(object sender, EventArgs e) { // Enter the value from the 'App Key' field obtained at developer.att.com in your // app account. string clientId = ""; // Enter the value from the 'App Secret' field obtained at developer.att.com // in your app account. string secretKey = ""; // Set the fully-qualified domain name to: https://api.att.com string fqdn = "https://api.att.com"; //Set the scope to AAB string scope = "SMS"; //Create the service for requesting an OAuth access token. var oauth = new OAuth(fqdn, clientId, secretKey, scope); //Get the OAuth access token using the Client Credentials. if (oauth.GetAccessToken(OAuth.AccessTokenType.ClientCredentials)) { // Get access token OAuthToken at = new OAuthToken(); string accessToken = at.getAccessToken(oauth.accessTokenJson); // Create the service for making the method request. var sms = new SMS(fqdn, accessToken); //************************************************************************* // Operation: Send SMS // Set params: string address = "tel:+10000000000"; string message = "<Enter message>"; string messageId = String.Empty; try { // Make an Make a method call to the SMS API. // Method takes: // param 1: address // param 1: message OutboundSMSResponseObj.RootObject sendSMSresponseObj = sms.sendSMS(address, message); messageId = sendSMSresponseObj.outboundSMSResponse.messageId; } catch (Exception respex) { string error = respex.StackTrace; } //************************************************************************* // Operation: Get SMS string RegistrationID = "00000000"; try { // Make an Make a method call to the SMS API. // Method takes: // param 1: RegistrationID InboundSmsMessageObj.RootObject getSMSresponseObj = sms.getSMS(RegistrationID); } catch (Exception respex) { string error = respex.StackTrace; } //************************************************************************* // Operation: Get SMS Delivery Status try { // Make an Make a method call to the SMS API. // Method takes: // param 1: messageID DeliveryInfoObj.RootObject deliveryStatusResponse = sms.getSMSDeliveryStatus(messageId); } catch (Exception respex) { string error = respex.StackTrace; } } }
protected void Page_Load(object sender, EventArgs e) { // Enter the value from the 'App Key' field obtained at developer.att.com in your // app account. string clientId = ""; // Enter the value from the 'App Secret' field obtained at developer.att.com // in your app account. string secretKey = ""; // Set the fully-qualified domain name to: https://api.att.com string fqdn = "https://api.att.com"; //Set the scope to MMS string scope = "MMS"; //Create the service for requesting an OAuth access token. var oauth = new OAuth(fqdn, clientId, secretKey, scope); //Get the OAuth access token using client Credential method. if (oauth.GetAccessToken(OAuth.AccessTokenType.ClientCredentials)) { // Get access token OAuthToken at = new OAuthToken(); string accessToken = at.getAccessToken(oauth.accessTokenJson); // Create the service for making the method request. var mms = new MMS(fqdn, accessToken); // Set params: string mmsAddress = Server.UrlEncode("tel:10000000000") + "&"; //e.g.tel:1234567890 string mmsMessage = Server.UrlEncode("msg txt context"); string mmsFile = Server.MapPath("~/") + "attachments/att.jpg"; //Attachement path string mmsContentType = "image/jpeg"; string messageId = ""; try { // Make an Make a method call to the MMS API. // Method takes: // param 1: string mmsAddress (phone number(s)) // param 2: message text content // param 3: file path // param 4: multipart content type OutboundMessageResponseObj.RootObject SendMMSResponseObj = mms.sendMMS(mmsAddress, mmsMessage, mmsFile, mmsContentType); messageId = SendMMSResponseObj.outboundMessageResponse.messageId; } catch (Exception respex) { string error = respex.StackTrace; } try { // Make an Make a method call to the MMS API. // Method takes: // param 1: string message id DeliveryInfoObj.RootObject getStatusResponseObj = mms.getMMSDeliveryStatus(messageId); } catch (Exception respex) { string error = respex.StackTrace; } } }