DocumentationBlogSupport
Log inSign up
Log inSign up
BlogSupport
Build
Getting StartedPlatform Introduction
Embedded Apps
OverviewDeveloper GuideSubmission Checklist for Embedded Apps
Design Guidelines
MeetingsMessagingDevices
API Reference
BotsButtons and CardsIntegrationsLogin with WebexWidgetsGuest IssuerWebex ConnectInstant Connect Meeting LinksDeveloper SandboxSubmit Your AppSupport PolicyFAQs
APIs
XML API DeprecationGetting StartedREST API BasicsComplianceWebhooksWebex APIs
Admin
OverviewAdmin APIsAuthentication
Guides
Hybrid ServicesWebhooksReal-time File DLP Basics
Reference
Admin Audit EventsAuthorizationsEventsGroupsHistorical AnalyticsHybrid ClustersHybrid ConnectorsLicensesLocationsMeeting QualitiesOrganizationsPeopleRecording ReportRecordingsReport TemplatesReportsResource Group MembershipsResource GroupsRolesSession TypesSpace ClassificationsTracking CodesWebex Calling Organization SettingsWebex Calling Person SettingsWebex Calling Workspace SettingsWholesale Billing ReportsWorkspace LocationsWorkspace MetricsWorkspaces
Calling
Overview
Guides
Integrations and AuthorizationWebex for BroadWorksWebex for WholesaleWholesale and Broadworks Common Guide
Reference
BroadWorks Billing ReportsBroadWorks Device ProvisioningBroadWorks EnterprisesBroadWorks SubscribersCall ControlsLocationsPeopleRecording ReportVideo MeshWebex Calling Detailed Call HistoryWebex Calling Organization SettingsWebex Calling Person SettingsWebex Calling Voice MessagingWebex Calling Workspace SettingsWholesale Billing ReportsWholesale CustomersWholesale Subscribers
Contact Center
Overview
Devices
Overview
Guides
DevicesWorkspace Integrations Guide
Reference
Device ConfigurationsDevicesWorkspace LocationsWorkspace MetricsWorkspace PersonalizationWorkspacesxAPI
Meetings
Overview
Guides
Integrations and AuthorizationWebhooksWebinar GuideMeeting Resource Guide
Reference
Meeting ChatsMeeting Closed CaptionsMeeting InviteesMeeting MessagesMeeting ParticipantsMeeting PollsMeeting PreferencesMeeting Q and AMeeting QualitiesMeeting TranscriptsMeetingsMeetings Summary ReportPeopleRecording ReportRecordingsSession TypesTracking CodesVideo MeshWebhooks
Messaging
Overview
Guides
BotsIntegrations and AuthorizationWebhooksButtons and Cards
Reference
Attachment ActionsEventsMembershipsMessagesPeopleRoom TabsRoomsTeam MembershipsTeamsTracking CodesWebhooks
Webex Assistant Skills
Guides
Skills SDK GuideSkills Developer PortalSkills Reference GuideSkills UX Guide
Overview
FedRAMP
Overview
Guides
Create a BotCreate an IntegrationNotes on API Support
Full API Reference
Admin Audit EventsAttachment ActionsAuthorizationsBroadWorks Billing ReportsBroadWorks Device ProvisioningBroadWorks EnterprisesBroadWorks SubscribersCall ControlsDevice ConfigurationsDevicesEventsGroupsHistorical AnalyticsHybrid ClustersHybrid ConnectorsLicensesLocationsMeeting ChatsMeeting Closed CaptionsMeeting InviteesMeeting MessagesMeeting ParticipantsMeeting PollsMeeting PreferencesMeeting Q and AMeeting QualitiesMeeting TranscriptsMeetingsMeetings Summary ReportMembershipsMessagesOrganizationsPeopleRecording ReportRecordingsReport TemplatesReportsResource Group MembershipsResource GroupsRolesRoom TabsRoomsSession TypesSiteSpace ClassificationsTeam MembershipsTeamsTracking CodesVideo MeshWebex Calling Detailed Call HistoryWebex Calling Organization SettingsWebex Calling Person SettingsWebex Calling Voice MessagingWebex Calling Workspace SettingsWebhooksWholesale Billing ReportsWholesale CustomersWholesale SubscribersWorkspace LocationsWorkspace MetricsWorkspace PersonalizationWorkspacesxAPI
API Changelog
SDKs
iOSAndroidBrowserNode.jsJava
Developer CommunityCertifications

Java SDK

GitHub

anchorFeatures
anchor
  • Manage Webex user accounts
  • Send messages and file attachments
  • Create spaces and manage space memberships
  • Create and manage webhooks
anchorGetting Started
anchor

This guide will get you up-and-running with the Webex Java SDK.

Overview
  • Create Webex spaces
  • Post messages
Requirements
  • Java 1.6 or greater
  • This SDK requires the spark:all scope
Step 1: Register for a Webex Account

Before using the SDK, you will need a Webex account and a developer access token. If you haven't already, head on over to Webex to create an account.

Once you have an account, log into this site to get your developer access token. You will need this token to authenticate API requests from the SDK.

Step 2: Install the Java SDK

The Java SDK is available on GitHub. Clone the repository and include the source files in your Maven project.

Step 3: Use the Java SDK
Create an Example Class

For this example, we'll create a very simple Example class and set the developer access token. You'll need this token to initialize the client.

import com.ciscospark.*;
import java.net.URI;

class Example {
  public static void main(String[] args) {
    // To obtain a developer access token, visit http://developer.webex.com
    String accessToken = "$YOUR_DEVELOPER_TOKEN";
Initialize the Webex Client

Initialize the client and set the endpoint to the current Webex API.

// Initialize the client
Spark spark = Spark.builder()
  .baseUrl(URI.create("https://webexapis.com/v1"))
  .accessToken(accessToken)
  .build();
Create a New Space

Let's create a space. For now this space will only have you in it. You can always add more people later.

// Create a new room
Room room = new Room();
room.setTitle("Hello World");
room = spark.rooms().post(room);
Post a Message

Now that we have a new space, let's post a message to it.

// Post a text message to the room
Message message = new Message();
message.setRoomId(room.getId());
message.setText("Hello World!");
spark.messages().post(message);
Full Code

Compile and run the new class to see the SDK in action. Log into Webex through one of the clients to see your new room and new message!

Here's the full code for the example class:

import com.ciscospark.*;
import java.net.URI;

class Example {
  public static void main(String[] args) {
    // To obtain a developer access token, visit http://developer.webex.com
    String accessToken = "$YOUR_DEVELOPER_TOKEN";

    // Initialize the client
    Spark spark = Spark.builder()
      .baseUrl(URI.create("https://webexapis.com/v1"))
      .accessToken(accessToken)
      .build();

    // Create a new room
    Room room = new Room();
    room.setTitle("Hello World");
    room = spark.rooms().post(room);

    // Post a text message to the room
    Message message = new Message();
    message.setRoomId(room.getId());
    message.setText("Hello World!");
    spark.messages().post(message);
  }
}
  • Features
  • Getting Started

Connect

Support

Developer Events

Contact Sales

Handy Links

Webex Ambassadors

Webex App Hub

Resources

Open Source Bot Starter Kits

Download Webex

DevNet Learning Labs

Terms of Service

Privacy Policy

Cookie Policy

Trademarks

© 2023 Cisco and/or its affiliates. All rights reserved.