diff --git a/libraries/Bridge/examples/Temboo/SendAnEmail/SendAnEmail.ino b/libraries/Bridge/examples/Temboo/SendAnEmail/SendAnEmail.ino index 63717a4c4..bb6b09b96 100644 --- a/libraries/Bridge/examples/Temboo/SendAnEmail/SendAnEmail.ino +++ b/libraries/Bridge/examples/Temboo/SendAnEmail/SendAnEmail.ino @@ -3,15 +3,44 @@ Demonstrates sending an email via a Google Gmail account using Temboo from an Arduino Yún. - Check out the latest Arduino & Temboo examples and support docs at http://www.temboo.com/arduino + Check out the latest Arduino & Temboo examples and tutorials at http://www.temboo.com/arduino A Temboo account and application key are necessary to run all Temboo examples. If you don't already have one, you can register for a free Temboo account at http://www.temboo.com - Since this sketch uses Gmail to send the email, you'll also need a valid - Google Gmail account. The sketch needs the username and password you use - to log into your Gmail account - substitute the placeholders below for these values. + Instructions: + + 1. Create a Temboo account: http://www.temboo.com + + 2. Retrieve your Temboo application details: http://www.temboo.com/account/applications + + 3. Replace the values in the TembooAccount.h tab with your Temboo application details + + 4. You'll also need a Gmail account. Update the placeholder Gmail address in the code + below with your own details. + + https://www.gmail.com + + 5. Once you have a Gmail account, turn on 2-step authentication, and create an application-specific + password to allow Temboo to access your Google account: https://www.google.com/landing/2step/. + + 6. After you've enabled 2-Step authentication, you'll need to create an App Password: + https://security.google.com/settings/security/apppasswords + + 7. In the "Select app" dropdown menu, choose "Other", and give your app a name (e.g., TembooApp). + + 8. Click "Generate". You'll be given a 16-digit passcode that can be used to access your Google Account from Temboo. + + 9. Copy and paste this password into the code below, updating the GMAIL_APP_PASSWORD variable + + 10. Upload the sketch to your Arduino Yún and open the serial monitor + + NOTE: You can test this Choreo and find the latest instructions on our website: + https://temboo.com/library/Library/Google/Gmail/SendEmail + + You can also find an in-depth version of this example here: + https://temboo.com/arduino/yun/send-an-email This example assumes basic familiarity with Arduino sketches, and that your Yún is connected to the Internet. @@ -34,8 +63,8 @@ // your Gmail username, formatted as a complete email address, eg "bob.smith@gmail.com" const String GMAIL_USER_NAME = "xxxxxxxxxx"; -// your Gmail password -const String GMAIL_PASSWORD = "xxxxxxxxxx"; +// your application specific password (see instructions above) +const String GMAIL_APP_PASSWORD = "xxxxxxxxxx"; // the email address you want to send the email to, eg "jane.doe@temboo.com" const String TO_EMAIL_ADDRESS = "xxxxxxxxxx"; @@ -82,8 +111,8 @@ void loop() // the first input is your Gmail email address. SendEmailChoreo.addInput("Username", GMAIL_USER_NAME); - // next is your Gmail password. - SendEmailChoreo.addInput("Password", GMAIL_PASSWORD); + // next is your application specific password + SendEmailChoreo.addInput("Password", GMAIL_APP_PASSWORD); // who to send the email to SendEmailChoreo.addInput("ToAddress", TO_EMAIL_ADDRESS); // then a subject line diff --git a/libraries/Bridge/examples/Temboo/SendDataToGoogleSpreadsheet/SendDataToGoogleSpreadsheet.ino b/libraries/Bridge/examples/Temboo/SendDataToGoogleSpreadsheet/SendDataToGoogleSpreadsheet.ino index 8918f9985..6bae2796e 100644 --- a/libraries/Bridge/examples/Temboo/SendDataToGoogleSpreadsheet/SendDataToGoogleSpreadsheet.ino +++ b/libraries/Bridge/examples/Temboo/SendDataToGoogleSpreadsheet/SendDataToGoogleSpreadsheet.ino @@ -3,31 +3,49 @@ Demonstrates appending a row of data to a Google spreadsheet using Temboo from an Arduino Yún. - Check out the latest Arduino & Temboo examples and support docs at http://www.temboo.com/arduino + Check out the latest Arduino & Temboo examples and tutorials at http://www.temboo.com/arduino A Temboo account and application key are necessary to run all Temboo examples. If you don't already have one, you can register for a free Temboo account at http://www.temboo.com - Since this sketch uses a Google spreadsheet, you'll also need a - Google account: substitute the placeholders below for your Google account values. - - This example assumes basic familiarity with Arduino sketches, and that your - Yún is connected to the Internet. - - The columns in your spreadsheet must have labels for the Choreo to - work properly. It doesn't matter what the column labels actually are, - but there must be text in the first row of each column. This example - assumes there are two columns. The first column is the time (in milliseconds) - that the row was appended, and the second column is a sensor value. - In other words, your spreadsheet should look like: + Instructions: + + 1. Create a Temboo account: http://www.temboo.com - Time | Sensor Value | - ------+----------------- - | | + 2. Retrieve your Temboo application details: http://www.temboo.com/account/applications - NOTE that the first time you run this sketch, you may receive a warning from - Google, prompting you to authorize access from a 3rd party system. + 3. Replace the values in the TembooAccount.h tab with your Temboo application details + + 4. You'll also need a Google Spreadsheet that includes a title in the first row + of each column that data will be written to. This example assumes there are two columns. + The first column is the time (in milliseconds) that the row was appended, and the second + column is a sensor value. In other words, your spreadsheet should look like: + + Time | Sensor Value | + ------+----------------- + | | + + 5. Google Spreadsheets requires you to authenticate via OAuth. Follow the steps + in the link below to find your ClientID, ClientSecret, and RefreshToken, and then + use those values to overwrite the placeholders in the code below. + + https://temboo.com/library/Library/Google/OAuth/ + + For the scope field, you need to use: https://spreadsheets.google.com/feeds/ + + Here's a video outlines how Temboo helps with the OAuth process: + + https://www.temboo.com/videos#oauthchoreos + + And here's a more in-depth version of this example on our website: + + https://temboo.com/arduino/yun/update-google-spreadsheet + + 6. Next, upload the sketch to your Arduino Yún and open the serial monitor + + Note: you can test this Choreo and find the latest instructions on our website: + https://temboo.com/library/Library/Google/Spreadsheets/AppendRow/ Looking for another API to use with your Arduino Yún? We've got over 100 in our Library! @@ -46,8 +64,14 @@ // Note that for additional security and reusability, you could // use #define statements to specify these values in a .h file. -const String GOOGLE_USERNAME = "your-google-username"; -const String GOOGLE_PASSWORD = "your-google-password"; +// the clientID found in Google's Developer Console under APIs & Auth > Credentials +const String CLIENT_ID = "your-client-id"; + +// the clientSecret found in Google's Developer Console under APIs & Auth > Credentials +const String CLIENT_SECRET = "your-client-secret"; + +// returned after running FinalizeOAuth +const String REFRESH_TOKEN = "your-oauth-refresh-token"; // the title of the spreadsheet you want to send data to // (Note that this must actually be the title of a Google spreadsheet @@ -112,11 +136,12 @@ void loop() // see https://www.temboo.com/library/Library/Google/Spreadsheets/AppendRow/ // for complete details about the inputs for this Choreo - // your Google username (usually your email address) - AppendRowChoreo.addInput("Username", GOOGLE_USERNAME); - - // your Google account password - AppendRowChoreo.addInput("Password", GOOGLE_PASSWORD); + // your Google application client ID + AppendRowChoreo.addInput("ClientID", CLIENT_ID); + // your Google application client secert + AppendRowChoreo.addInput("ClientSecret", CLIENT_SECRET); + // your Google OAuth refresh token + AppendRowChoreo.addInput("RefreshToken", REFRESH_TOKEN); // the title of the spreadsheet you want to append to // NOTE: substitute your own value, retaining the "SpreadsheetTitle:" prefix. diff --git a/libraries/Bridge/library.properties b/libraries/Bridge/library.properties index 0f1a970cb..ac8ebd9bb 100644 --- a/libraries/Bridge/library.properties +++ b/libraries/Bridge/library.properties @@ -1,5 +1,5 @@ name=Bridge -version=1.0.6 +version=1.0.7 author=Arduino maintainer=Arduino sentence=Enables the communication between the Linux processor and the AVR. For Arduino Yún and TRE only.