webex-teams-api-wrapper
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

Webex API Service Wrapper

Table Of Contents

Introduction

This wrapper supposed to provied a simple solution to interact with the Webex API in TypeScript projects.

This project is work in progress state. The endpoint modules will be added with time.

Getting started

Downloading the module

The module can be downloaded to your project from the NPM repository by executing the following command:

npm install webex-teams-api-wrapper --save

Importing to your project

When downloaded, the module can be simply imported

In your typescript project:

import Webex from "webex-teams-api-wrapper";

In your javascript project:

const webex = require("webex-teams-api-wrapper").default;

Usage

The endpoint methods can be called from the Webex object after it is instantiated.

Instantiating the Webex object

In your project, after importing the module, you can simply create a new instance with the new keyword.

const webex = new Webex("<YOUR PERSONAL ACCESS TOKEN>");

For this you will need to provide your Personal Access Token.

Endpoints

The currently implemented endpoints can be used from the Webex object. The list of these will grow with time.

Every endpoint method will return a promise with the respective responses.

Messages

Messages are how we communicate in a room. In Webex Teams, each message is displayed on its own line along with a timestamp and sender information. Use this API to list, create, and delete messages.

Message can contain plain text, rich text, and a file attachment.

Just like in the Webex Teams app, you must be a member of the room in order to target it with this API.

Webex Messages Endpoint Documentation

List Messages

listMessages(query: ListMessagesQuery): Promise<ListMessagesResponse>

Lists all messages in a room. Each message will include content attachments if present.

The list sorts the messages in descending order by creation date.

Long result sets will be split into pages.

List Messages Documentation

List Direct Messages

listDirectMessages(query: ListDirectMessagesQuery): Promise<ListDirectMessagesResponse>

Lists all messages in a 1:1 (direct) room. Use the personId or personEmail query parameter to specify the room. Each message will include content attachments if present.

The list sorts the messages in descending order by creation date.

List Direct Messages Documentation

Create Message

createMessage(query: CreateMessageQuery): Promise<CreateMessageResponse>

Post a plain text or rich text message, and optionally, a file attachment attachment, to a room.

The files parameter is an array, which accepts multiple values to allow for future expansion, but currently only one file may be included with the message.

Create Message Documentation

Get Message Details

getMessageDetails(messageId: string): Promise<GetMessageDetailsResponse>

Shows details for a message, by message ID.

Specify the message ID in the messageId parameter in the URI.

Get Message Documentation

Delete Message

deleteMessage(messageId: string): Promise<any>

Deletes a message, by message ID.

Specify the message ID in the messageId parameter in the URI.

Delete Message Documentation

People

People are registered users of Webex Teams. Searching and viewing People requires an auth token with a scope of spark:people_read. Viewing the list of all People in your Organization requires an administrator auth token with spark-admin:people_read scope. Adding, updating, and removing People requires an administrator auth token with the spark-admin:people_write scope.

To learn more about managing people in a room see the Memberships API. For information about how to allocate Hybrid Services licenses to people, see the Managing Hybrid Services guide.

Webex People Endpoint Documentation

List People

listPeople(query: ListPeopleQuery): Promise<ListPeopleResponse>

List people in your organization. For most users, either the email or displayName parameter is required. Admin users can omit these fields and list all users in their organization.

Response properties associated with a user's presence status, such as status or lastActivity, will only be displayed for people within your organization or an organization you manage. Presence information will not be shown if the authenticated user has disabled status sharing.

Long result sets will be split into pages.

List People Documentation

Create a Person

createPerson(query: CreatePersonQuery): Promise<CreatePersonResponse>

Create a new user account for a given organization. Only an admin can create a new user account.

At least one of the following body parameters is required to create a new user: displayName, firstName, lastName.

Currently, users may have only one email address associated with their account. The emails parameter is an array, which accepts multiple values to allow for future expansion, but currently only one email address will be used for the new user.

Create Person Documentation

Get Person Details

getPersonDetails(query: GetPersonDetailQuery): Promise<GetPersonDetailResponse>

Shows details for a person, by ID.

Response properties associated with a user's presence status, such as status or lastActivity, will only be displayed for people within your organization or an organization you manage. Presence information will not be shown if the authenticated user has disabled status sharing.

Specify the person ID in the personId parameter in the URI.

Get Person Detail Documentation

Update a Person

updatePerson(personId: string, query: UpdatePersonQuery): Promise<UpdatePersonResponse>

Update details for a person, by ID.

Specify the person ID in the personId parameter in the URI. Only an admin can update a person details.

Include all details for the person. This action expects all user details to be present in the request. A common approach is to first GET the person's details, make changes, then PUT both the changed and unchanged values.

Update Person Documentation

Delete a Person

deletePerson(personId: string)

Remove a person from the system. Only an admin can remove a person.

Specify the person ID in the personId parameter in the URI.

Delete Person Documentation

Get My Own Details

getMyOwnDetails(): Promise<GetMyOwnDetailsResponse>

Show the profile for the authenticated user. This is the same as GET /people/{personId} using the Person ID associated with your Auth token.

Get My Own Details Documentation

Rooms

Rooms are virtual meeting places where people post messages and collaborate to get work done. This API is used to manage the rooms themselves. Rooms are created and deleted with this API. You can also update a room to change its title, for example.

To create a team room, specify the a teamId in the POST payload. Note that once a room is added to a team, it cannot be moved. To learn more about managing teams, see the Teams API.

To manage people in a room see the Memberships API.

To post content see the Messages API.

List Rooms

listRooms(query: ListRoomsQuery): Promise<ListRoomsResponse>

The title of the room for 1:1 rooms will be the display name of the other person.

By default, lists rooms to which the authenticated user belongs.

Long result sets will be split into pages.

List Rooms Documentation

Create a Room

createRoom(query: CreateRoomQuery): Promise<CreateRoomResponse>

Creates a room. The authenticated user is automatically added as a member of the room. See the Memberships API to learn how to add more people to the room.

To create a 1:1 room, use the Create Messages endpoint to send a message directly to another person by using the toPersonId or toPersonEmail parameters.

Create a Room Documentation

Get Room Details

getRoomDetails(query: GetRoomDetailsQuery): Promise<GetRoomDetailsResponse>

Shows details for a room, by ID.

The title of the room for 1:1 rooms will be the display name of the other person.

Specify the room ID in the roomId parameter in the URI.

Get Room Details Documentation

Get Room Meeting Details

getRoomMeetingDetails(query: GetRoomMeetingDetailsQuery): Promise<GetRoomMeetingDetailsResponse>

Shows Webex meeting details for a room such as the SIP address, meeting URL, toll-free and toll dial-in numbers.

Specify the room ID in the roomId parameter in the URI.

Get Room Meeting Details

Update a Room

updateRoom(query: UpdateRoomQuery): Promise<UpdateRoomResponse>

Updates details for a room, by ID.

Specify the room ID in the roomId parameter in the URI.

Update a Room Documentation

Delete a Room

deleteRoom(query: DeleteRoomQuery): Promise<boolean>

Deletes a room, by ID. Deleted rooms cannot be recovered.

Deleting a room that is part of a team will archive the room instead.

Specify the room ID in the roomId parameter in the URI.

Delete a Room Documentation

Return Values

Every endpoint method will return a Promise. Examples will be available later.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.3
    0
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.3
    0
  • 1.0.2
    1
  • 1.0.1
    1
  • 1.0.0
    1

Package Sidebar

Install

npm i webex-teams-api-wrapper

Weekly Downloads

3

Version

1.0.3

License

ISC

Unpacked Size

84 kB

Total Files

110

Last publish

Collaborators

  • enisz