Webex Integration with MuleSoft
- February 23, 2024
Purpose
This article describes the process of integrating MuleSoft with Webex REST APIs. Webex supports integration using OAuth2 Authorization Code, which enables the creation/modification of Webex events from MuleSoft. We’ll also create a meeting using this integration and view it by using the list operation.
Prerequisites
Create a free Webex account using https://signup.webex.com/sign-up
Create an integration app on Webex
To securely invoke the Webex REST API, the Webex API supports the OAuth2 standard, which enables third-party integrations to obtain a temporary access token for authenticating API calls rather than require users to provide their passwords.
Here are the steps to create an integration app on Webex:
- Go to https://developer.webex.com/ and select My Webex Apps from the menu under your avatar at the top of the page
- Select Create a New App
- Select Create an Integration
- Provide the basic information for your integration, including the integration’s name, description, redirect URI(s) and logo, then click Add Integration
Here is the information provided for our purpose:
- Integration name: Mule_Integration
- Description: Mule_Integration
- Redirect URI(s): http://localhost:8081/webex/callback
- Scopes: meeting:schedules_read, meeting:schedules_write
- Once the integration is registered, you’ll be able to see the Client ID and Client Secret to use for the Mule integration
Integration with MuleSoft
When integrating with MuleSoft, first create a meeting and then fetch the same meeting details.
Here are the steps:
- Import the OAuth and ObjectStore modules into the project
- Add a Listener configuration with default values
- Add an Object Store configuration with default values
- Add a Request configuration and configure it as follows:
- Authentication: Authorization code grant type
- Local callback config path: “/webex/callback”
- External callback URL: “http://localhost:8081/webex/callback”
- Local authorization URL: “http://localhost:8081/webex/authorize”
- Authorization URL: “https://webexapis.com/v1/authorize”
- Client ID: “xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx”
- Client secret: “xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx”
- Token URL: “https://webexapis.com/v1/access_token”
- Scope: “spark:kms meeting:schedules_read meeting:schedules_write”
- In a new flow, for creating a meeting, drag a Listener with the Path as /webex/createMeetings
- Drag a Transform Message component and include the payload as follows:
%dw 2.0 output application/json --- { "title": "Daily Demo Meeting", "agenda": "Daily Demo Meeting Agenda", "start": "2024-01-25 20:00:00", "end": "2024-01-25 20:30:00" }
- Drag a Request component and set the Method as POST, the URL as https://webexapis.com/v1/meetings and the Body as payload
- Drag Set Payload and set the value as output application/json — payload
- The flow for Create Meeting should look like this:
- In a new flow, for listing a meeting, drag a listener with the Path as /webex/listMeetings
- Drag a Request component and set the Method as GET and the URL as https://webexapis.com/v1/meetings?from=2024-01-25&max=10
- Drag Set Payload and set the value as output application/json — payload
- The List Meeting flow should look like this:
- Run the project
- Open a browser window and use this
URL: http://localhost:8081/webex/authorize - Now click on new window to Create Meeting with the
URL http://localhost:8081/webex/createMeetingsYou’ll see a long response that looks like this:
- Now hit on new window to List Meeting with the
URL http://localhost:8081/webex/listMeetingsYou’ll see a long response that looks like this:
a. Log in with your account info when you see the following window:
b. Once it asks for permission, click Accept
c. Once the token is stored in the Object Store, you’ll see a success message that looks like this:
Conclusion
To access different kinds of Webex REST APIs, such as Create Meeting, Delete Meeting and Add Meeting Invitees, you can use the above configuration and update only the Request component with the desired payload.
References
https://developer.webex.com/docs/integrations
https://developer.webex.com/docs/api/v1/meetings
— By Shubham Jaiswal