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:

  1. Go to https://developer.webex.com/ and select My Webex Apps from the menu under your avatar at the top of the page

    WebEx for developers Site

  2. Select Create a New App

    WebEx Site Tab for creating new new

  3. Select Create an Integration

    Create an integration in webex site

  4. 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
  5. Once the integration is registered, you’ll be able to see the Client ID and Client Secret to use for the Mule integration

    Mule integration registration page

Integration with MuleSoft

When integrating with MuleSoft, first create a meeting and then fetch the same meeting details.

Here are the steps:

  1. Import the OAuth and ObjectStore modules into the project

    Search tab in Mule Palette

  2. Add a Listener configuration with default values
  3. Add an Object Store configuration with default values
  4. Add a Request configuration and configure it as follows:
    1. Authentication: Authorization code grant type
    2. Local callback config path: “/webex/callback”
    3. External callback URL: “http://localhost:8081/webex/callback”
    4. Local authorization URL: “http://localhost:8081/webex/authorize”
    5. Authorization URL: “https://webexapis.com/v1/authorize”
    6. Client ID: “xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx” 
    7. Client secret: “xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx”
    8. Token URL: “https://webexapis.com/v1/access_token”
    9. Scope: “spark:kms meeting:schedules_read meeting:schedules_write”

      Mule Meeting schedule page


      Mule Meeting schedules page2

  5. In a new flow, for creating a meeting, drag a Listener with the Path as /webex/createMeetings

    Creating meeting in WebEx

  6. 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"
    }
    
  7. Drag a Request component and set the Method as POST, the URL as https://webexapis.com/v1/meetings and the Body as payload

    Create a meeting for set a method as post

  8. Drag Set Payload and set the value as output application/json — payload
  9. The flow for Create Meeting should look like this:

    Flow a meeting

  10. In a new flow, for listing a meeting, drag a listener with the Path as /webex/listMeetings

    List a meeting in webex

  11. 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

    List a meeting for set a method as Get

  12. Drag Set Payload and set the value as output application/json — payload
  13. The List Meeting flow should look like this:

    List meeting flow

  14. Run the project
  15. Open a browser window and use this
    URL: http://localhost:8081/webex/authorize
  16. a. Log in with your account info when you see the following window:

    WebEx sigh in page

    b. Once it asks for permission, click Accept

    Requesting Permission Mule Integration

    c. Once the token is stored in the Object Store, you’ll see a success message that looks like this:

    Login success in webex site

  17. Now click on new window to Create Meeting with the
    URL http://localhost:8081/webex/createMeetings

    You’ll see a long response that looks like this:

    Data for creating meetings

  18. Now hit on new window to List Meeting with the
    URL http://localhost:8081/webex/listMeetings

    You’ll see a long response that looks like this:

    Data for Listing meeting

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