Use this control when you want to add an instance of a class that has no user interface to your page. Add the AuthenticationRequired event to MySocket with this code: Name = kAccountSIDĪfter you’ve filled in the AccountSID, AuthToken and phone numbers you can run the project. Project Types: Web Platforms: macOS, Windows, Linux : Class (inherits from Object) New in 2010r5. Lastly, you need to provide the authorization. Send Request, results (including any errors) are in MySocket.PageReceived event handler MySocket.SetRequestContent(data, "application/x-www-form-urlencoded")ĭim url As Text = "" + kAccountSID + "/Messages.json" Params.Append("Body=" + EncodeURLComponent("This Is the ship that made the Kessel Run In fourteen parsecs?").ToText)ĭim textParams As Text = Text.Join(params, "&")ĭim data As = 8.ConvertTextToData(textParams) Here is an example that uses a For loop to cycle through all the controls in a window to test whether each control is a DesktopTextField. With the IsA operator, you test whether an object is of a specific subclass and, if it is, cast it as that type to do something specific with it. Params.Append("To=" + EncodeURLComponent(kToPhone).ToText) You use the IsA operator to cast objects. Params.Append("From=" + EncodeURLComponent(kFromPhone).ToText) To test sending a message, I dragged a button to the Window. The CURL sample code translated to Xojo code looks like this, which I just put on the Button’s Action event handler: Const kFromPhone = "" // Use your Twilio-assigned phone number hereĬonst kToPhone = "" // A phone number to send the test message to I then dragged a “Generic Object” onto the Window layout and changed these properties: (Grab those values from your Twilio dashboard.) On Window1, I added two Constants for the Account SID and Auth Token: To start, I created a new Desktop project. Click the drop-down to switch to the sample code for CURL, which is what I’ll use to translate to Xojo code.Įssentially, I’m using a to send call the Twilio web service to send the SMS message. On this page you will see some sample code on the right. To send an SMS message, you want to take a look at their SMS REST API which is here: Twilio has a lot of documentation on how to use their various services. Remember, some mobile carriers charge to send and receive text messages so keep this in mind when planning to text via your app. Twilio is not a free service but you can get a free developer account with a credit to test it out.Ī standard text message is sent using either SMS or MMS. To send someone a text you simply need their mobile phone number. Twilio has many types of services related to telephones, including making and receiving phone calls and text messages. From time to time, people ask me if it’s possible to send text messages from their apps. As is the case with most things, the answer is “Yes, if you know how” □ One of the easiest ways to send text messages is to use a web service called Twilio.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |