Author: Prince Kumar
GoToMeeting is an online meeting, desktop sharing, and video conferencing software package that enables the user to meet with other computer users, customers, clients, or colleagues via the Internet in real-time.
Use Case
In today’s use case will be integrating GotoMeet with Mulesoft using Oauth 2.0. Before doing all this create a developer account on LogMeIn https://developer.goto.com/signup/
Now your screen looks like this as shown here in the below screenshot.
Now click on the OAuth Clients and create a new client here by following simple 3 steps.
- Give the name of the client add some description if you want and add redirect URI as shown
- http://localhost:8081/callback
- https://oauth.pstmn.io/v1/callback
Click Next.
- Add the necessary scopes as shown in the screenshot below.
- Click save and you will be redirected to the credentials page you must save client id and client secret for future use and then click on save. Now your client is ready.
Important Points
- First of all, we will be creating a meeting by using REST API provided by GoToMeeting from Postman.
- And from Mulesoft we gonna be trying to fetch all the meetings.
1. Open Postman and click on “+” button to create a new tab. Go to Authorization -> Inside type choose OAuth 2.0 and in the right side now configure a new token and fill the details what it asks for.
In the callback URL please check “Authorize using browser”
Now click on Get New Access Token you will be redirected to the default browser and then click on open in Postman you will again be redirected to the Postman with the access token and refresh token. You just need to click on “Use token”.
2. Now You are ready to make API call in the Postman. So for creating a new meeting just open GoToMeeting REST API documentation and search for create meeting REST API link and copy this link https://api.getgo.com/G2M/rest/meetings
3. Now paste this link inside the request URL of the postman. Change the method from GET to POST and inside body paste the below JSON.
{
“subject”: “GATE EXAMINATION”,
“starttime”: “2021-12-29T11:48:28+0000”,
“endtime”: “2021-12-30T11:48:28+0000”,
“passwordrequired”: false,
“conferencecallinfo”: “VoIP”,
“timezonekey”: “IST”,
“meetingtype”: “immediate”
}
4. And hit the send button you will get a response something like this one as shown below in the screenshot.
Now it’s high time to integrate GoToMeeting with MuleSoft.
Step 1. Create a mule application. Drag and drop the HTTP Listener in the canvas and configure it.
Step 2. Now use set variable (code) that will store the code from query parameter when we hit this link on the browser.
https://api.getgo.com/oauth/v2/authorize?client_id={clientID}&response_type=code&redirect_uri={redirectUri}
In the above link
clientID = put your Oauth client id which you have stored earlier
redirectUri = http://localhost:8081/callback
Step 3. Go to https://www.base64encode.org/ and encode your clientID and client secret like in this format
clientID:clientSecret ( Remember not to forget colon in the middle)
And generate the encoded form of clientID and client secret which we will be using further.
Step 4. Now to get the access token we just need to make a POST request with code that I have stored in the variable and in the exchange of that code we will be getting access token so drag and drop the Request component of HTTP module configure it. Click on the plus button and make the following changes.
Host : api.getgo.com and click on ok.
Method : POST
Path : /auth/v2/token
Inside Headers
“Authorization” : “Basic {encoded form of clientID and client secret}”
Remember after Basic give some space
“Accept” : “application/json”
“Content-Type” : “application/x-www-form-urlencoded”
Inside QueryParameter
“redirect_uri” : “http://localhost:8081/callback”
“code” : vars.code
“grant_type” : “authorization_code”
Step 5. Again drag and drop the Request component inside the canvas. Through this, we will be consuming a REST API that will fetch all the meetings created in GoToMeeting when we sent a GET request on the given link.
https://api.getgo.com/G2M/rest/meetings
Inside headers
“Authorization” : payload.token_type ++ ” ” ++ payload.access_token
“Accept” : “application/json”
Step 6. Drag and drop the Transform message.
%dw 2.0
output application/json
—
payload
Step 7. Save the project and run it and wait for its deployment.
Step 8. Replace your clientID and redirect URI with {clientID} and {redirectUri} and make a request in the browser. https://api.getgo.com/oauth/v2/authorize?client_id={clientID}&response_type=code&redirect_uri={redirectUri}
You will get the meeting that you have created in Postman. I have already created other meetings that is why it is showing here.