Sending an email with the REST API is a breeze


Here we'll show you how to use our REST API to send an email via Gmail.

Get Set Up

1 Log in to Temboo. If you don't already have an account, you can register for free here.

2You'll also need a Gmail account, which you can create here. To authenticate with Google, you'll want to enable 2-Step Verification and generate an App Password for Temboo.

3Sign in to your Google Account settings page by clicking on your name or picture in the upper right corner of the screen and then clicking Account.

4Scroll down to the "Signing in" box.

5Click 2-Step Verification. This will bring you to the 2-Step Verification settings page.

6You will then see a step-by-step guide which will guide you through the setup process.

7After you've enabled 2-Step Verification, you'll be prompted to create an App Password.

8In the Select app dropdown menu, choose "Other", and give this app a name (e.g., TembooApp).

9Click "Generate". You'll be given a 16-digit passcode that can be used to access your Google Account from Temboo.

Note: If you wish to authenticate with OAuth credentials, you should use the Google > Gmailv2 Choreos.

10 Go to the Google > Gmail > SendEmail Choreo in our Library.

11Fill in your Gmail username (email address) and App-specific password, then hit the Save Profile button to save a Profile for your Gmail account. Now you can reuse your Gmail authentication details on any of our Gmail Choreos and it will also make your REST API calls simpler and more secure.

Test the Choreo

12Now let's test the Google > Gmail > SendEmail Choreo directly from our website. Select REST API from the drop down menu at the top of the page, then insert your new Profile and fill in the rest of the required inputs.

13 Click Generate Code to test the Choreo from our website, and you'll see the value "true" for the Success output in the Output section. Assuming you emailed yourself, you can go to your inbox and see the email appear!

Try it with Curl

14Scroll down to find the Code section of the Choreo page and copy the auto-generated cURL command. Your command should look something like this:

curl --basic -u APP_NAME:APP_KEY --header "x-temboo-domain: /ACCOUNT_NAME/master" --header "Content-Type: application/json" --header "Accept: application/json" -X POST --data '{"preset":"YOUR_GMAIL_PROFILE", "inputs": [{"name":"MessageBody", "value":"test message"}, {"name":"Subject", "value":"test subject"}, {"name":"FromAddress", "value":"your_username@gmail.com"}, {"name":"ToAddress", "value":"john.doe@temboo.com"}]
}' "https://ACCOUNT_NAME.temboolive.com/temboo-api/1.0/choreos/Library/Google/Gmail/SendEmail"

15Run the command and check your inbox - your email should be waiting.

What next?

We're all finished! Now you're successfully sending emails with our REST API. Check out what else you can do by exploring the 2000+ Choreos in our Library.

Once you've got your code up and running, you're ready to move on and do more. From monitoring your running applications, to moving your generated Temboo code to your preferred development environment and sharing it with colleagues, collaborators and friends - we've got you covered.

Need help?

We're always happy to help. Just email us at support@temboo.com, and we'll answer your questions.


Back