Tips, Tricks and CodeTips, Tricks and Code

Tutorial - Using Google services with webMethods.io Integration

This article is a short guide for those wanting to use Google (e.g. gmail™, sheets™) with webMethods.io Integration. Shout-out to Vidyesh for some crucial pointers.

Workflow

The proposed flow is very simple:

Run on demand, get some rows from a Google Sheets workbook and print them using the Logger (hidden in the Loop).

If you look closely at the figures in the article you are likely to see some mismatching names - this is due to me creating new versions of something that was already there, don't let that distract you.

Steps to follow:

Authorize webMethods.io to access Google

Log in using the account you are going to use for the exercise (for testing I would really recommend using a “throw-away” account, or at the least, revoke any access afterwards!)

Go to “Credentials”, shown below:

As you can see, I already have webMethods.io added as an OAuth2 client, add yours as shown below:

Create a new OAuth Client ID (choose web application):

Note that the URLs used should be the base URL of your webMethods.io tenant.

Once created, you can retrieve the Client ID and secret at any time by looking at the detail of the client you just created. Also see the “Download JSON” link – this gives you everything in one handy file. It contains sensitive information though, SO BE CAREFUL WHERE YOU STORE IT AND DO NOT SHARE IT WITH ANYBODY.

The important parts of the JSON file are the following:

You will need this information to get your Google access token – more about this later.

In this example, we are interested in Google Sheets, highlighted below:

You may need the scopes in the next activity – completing the OAuth consent screen:

Add the scope(s) if they are not available (like the one shown above that ends in “readonly”). Click the "manually paste" link to get the little text box where you can add it:

Also make sure that you enable the API for use in your project (API Library tab) - if you don't, you are likely going to run into an error when you try using it in the workflow:

You should now be good to go and in a position to use this configuration in webMethods.io Integration.

In a client that support OAuth, get your token

I used the RESTer plugin for Firefox – feel free to use whatever works for you (I could not get my favorite Postman to work, Google was unhappy with the browser it uses, if you manage to get this working, please let me know!)

Complete the following information to get your access token:

If you click on the OAuth2 configuration (mine is called “gmail” as you can see in the following figure) that you set up in the previous step, you should see popup screens for authentication/ authorization. If successful, you should see a new token appear under “Use existing tokens”, highlighted below:

You can get the access token by going to the “Headers” tab, copy the value of the token (the part that is highlighted):

In webMethods.io Integration workflow

Open the workflow (shown at the start of the article) and configure the Google Sheets connector:

In this example, I want to “Get Rows”:

Add the authorization – this brings up a new screen (name and Client ID are hidden from view here) - use the client ID and secret that you got when you registered the client and use the Refresh URL and Grant Type as shown below. I used the same token for access and refresh token - probably not a good idea, but since I can only get teh Bearer token in RESTer, I stuck with that.

If you get a message that the action was successful, save and continue. If not, look at the error (the message may not be very helpful - recheck all of your inputs, make sure you have no leading/ trailing spaces).

Below is an example of what you should see (Spreadsheet ID and Sheet Name will show you a list of what is available if you click the “expand” icon - this is also where you are likely to see an error if you forgot to enable the API as was mentioned earlier in the article):

Then test:

Click "Test"

Now configure the logger in the loop:

And once completed, run your workflow:

As you can see – this very simple flow fetched data from Google Sheets and printed it out.

And that concludes the test and the article. It is a very simple example, but the same approach works with Gmail and should work with any of the Google connectors that are available although I have not tested them all.

Update: I found that I can use Postman to get the Google tokens - but for one of my accounts (the one I used in the tutorial) this does NOT work for some reason that I haven't been able to figure out yet. Also, if you add "?access_type=offline" to the authorization URL, it should return a refresh token when you call it the first time.

This article describes OData 2.0 connector usage in webMethods.io Integration with OData connector use case. Use case: Get the list of products from public OData backend services and write them to n ...

Introduction webMethods.io Integration is an integration platform as a service (iPaaS) that lets you connect web apps, on-premise systems, and devices to create customized integrations and automate ...

"If you have not developed Cloud Strategy yet, you are likely falling behind with your business" - Gartner. Do you plan to move to Cloud? When and how do you want to move to cloud? What is your Digi ...

Overview Collection of examples for beginner webMethods-io developers. It consists of common use cases and starting points for developers getting up to speed with webMethods.io. Each example will co ...

The Basics: Terminology Workflow A workflow is a connection between two or more web apps or services. Creating a workflow means defining the steps of a recurring task that you want to automate. You ...

The next generation of Software AG’s iPaaS In April Software AG unveiled webMethods.io, the next generation of Software AG’s integration Platform as a Service (iPaaS), which combines low-code usabil ...

Get to know Software AG’s new webinar series DevCast Demos is Software AG’s new webinar series focusing on powerful integration and API strategies so your organization can be “innovation-ready.” The ...

Are you facing a mandate to move a large percentage of your applications and systems to the cloud? Simply collect and package your integrations from your datacenter and “Lift & Shift” them to the cl ...

Your Choice Regarding Cookies on this Site

This website uses special cookies to improve your experience and save your time.
Click "Agree" to accept the use of cookies and continue browsing. Or, go to the privacy policy to change the cookie settings.