We all know that usernames and passwords can be difficult to remember. Imagine trying to memorize your API Authentication information for multiple APIs! Profiles help you keep your API credentials organized, they have the added benefit of conserving memory in resource-constrained devices, and make it possible to remotely re-program your device without modifying code.
Sound amazing? Here we'll show you how to get the most out of your Profiles, or you can check out the video below.
For this example, we're generating code for a Twilio > SMSMessages >SendSMS Choreo that will run on an embedded hardware device, but you can follow along and use Profiles with any Choreo and any platform.
1To save a Profile, you'll need a Temboo account. If you don't already have one, you can register for a free account here.
2We've already created a free Twilio account, which we need to obtain the credentials we need to run the Twilio Choreos.
3The Choreo needs a Twilio phone number, along with the Account SID and Auth Token. Here's what ours look like in the Twilio dashboard.
A Twilio Account SID and Auth Token in the Twilio dashboard
5Back on the Choreo page, we've selected our board and how it's connected.
6Next, we'll plug in the Account SID and Auth Token obtained from Twilio into the appropriate input fields.
7Note that when a value is placed into one of the input fields, the "Save Profile" option appears. We could go ahead and save these two API Credentials into a Profile, but instead, we'll move to the next step and add a few more inputs.
8Now we'll add our Twilio "From" number. This is the number that you've purchased or received from Twilio.
9In the "To" number field, we'll add the phone number where we'd like to send an SMS. Finally, we'll add the "Body" of the message. If we scroll down to the code block, we can see that each of the inputs have been added to the auto-generated code.
10Here's where the magic happens. We'll click "Save Profile" at the top of the Input box, and a text box field appears where the Profile can be given a name.
11This time when we scroll down to the code, we see that the several lines of code for your inputs have been replaced by one simple, elegant line for the Profile that includes all of the inputs. Eliminating those lines of code conserves memory on resource-constrained devices. This will be especially important when you start combining Choreos.
12We've designed Profiles to be flexible, so you can combine code that uses a Profile with code that sets a specific inputs. You can even override values that you've stored in a Profile by editing the generated code to add the input you want to override. In the example below, we're overriding the value of the "To" phone number:
SendSMSChoreo.setProfile("myFirstTwilioProfile"); SendSMSChoreo.addInput("To", "12065999154");
13When you're running code that contains a Profile, you can use our website to remotely alter the behavior of your code, even while it's running. In this example, we'd go back to the Choreo page, and change the "Body" input to a new message. You should see the "Save" message come up near the "Profiles" dropdown menu. Save the profile as the same name.
14If you're running the Twilio code we generated earlier, the next text message you receive should be the second message that you created. Pretty cool, isn't it?
Now that you've figured out how to work with Profiles, why not check out the 2000+ Choreos in our Library and start thinking about all the possibilities for your next hardware project?
We're always happy to help. Just email us at email@example.com, and we'll answer your questions.