Skip to content

API Client

pumble-sdk provides an API client (ApiClient) for easier interaction the Pumble API. ApiClient contains methods that perform respective API calls, which can be done on behalf of either a user or a bot.

Every Request to Pumble API must be sent with two headers:

  1. x-app-token: Your app token that you receive when app is created. See manifest.
  2. token: The access token of the user or bot. See Authorization.

ApiClient automatically includes these headers in the requests, so they don't need to be specified manually when invoking its methods.

pumble-sdk provides an easy way to get the user or bot client from a trigger context. See Triggers.

Each ApiClient method has its own set of required scopes.

For more details about the usage of Pumble API, take a look at the Pumble API documentation.

Messages

client.v1.messages

methodscopesdescription
fetchMessagemessages:readGet message by ID and channel ID
fetchMessageschannels:readPaginate through channel messages
fetchThreadReplieschannels:readFetch thread messages
postMessageToChannelmessages:write, files:write(optional)Post a message to a channel
dmUserchannels:read, messages:write, files:write(optional)Send a direct message to a user
replymessages:write, files:write(optional)Reply in a thread
postEphemeralmessages:writeSend an ephemeral message to a user or list of users
replyEphemeralmessages:writeSend an ephemeral message to a user or list of users in a thread
editMessagemessages:editEdit a message
deleteMessagemessages:deleteDelete a message
editEphemeralMessagemessages:editEdit an ephemeral message
deleteEphemeralMessagemessages:deleteDelete an ephemeral message
editAttachmentsattachments:writeEdit a message attachments
addReactionreaction:writeReact to a message
removeReactionreaction:writeRemove reaction from a message
searchMessagesmessages:read, channels:listSearch messages
fetchScheduledMessagemessages:readGet scheduled message by ID
fetchScheduledMessagesmessages:readList pending scheduled messages
createScheduledMessagemessages:writeSchedule a message
editScheduledMessagemessages:editEdit a scheduled message
editScheduledMessageAttachmentsattachments:writeEdit scheduled message attachments
deleteScheduledMessagemessages:deleteDelete a scheduled message

File Upload

When sending a message, it is possible to specify a list of files that will be uploaded and sent within the message. A file can be specified by providing the file path, or in a form of a Blob or Buffer, in which case it is mandatory to provide file name and mime type as well:

typescript

type FileToUpload = {
    input: String,
    options?: FileUploadOptions
} | { 
    input: Buffer | Blob, 
    options: FileUploadOptions 
}

interface FileUploadOptions {
    name: string,
    mimeType: string
}

A message can contain up to 20 files, and each file size must not exceed 512MB.

Channels

client.v1.channels

methodscopesdescription
getDirectChannelchannels:readGet the direct channels between the requesting user and a list of users
createDirectChannelchannels:writeCreate a direct channel with one or more users
getChannelDetailschannels:readGet channel info by ID
listChannelschannels:listList user visible channels
createChannelchannels:writeCreate a Public or Private channel
addUsersToChannelchannels:writeAdd one or more users in a channel
removeUserFromChannelchannels:writeRemove a user from a channel

Users

client.v1.users

methodscopesdescription
listWorkspaceUsersusers:listList Workspace Users
listUserGroupsusers:listList User Groups
getProfileGet authorizing user basic info
userInfouser:readGet user by ID
updateCustomStatusstatus:writeUpdate user status

Workspaces

client.v1.workspace

methodscopesdescription
getWorkspaceInfoworkspace:readGet workspace info

Calls

client.v1.calls

methodscopesdescription
createPermanentCallcalls:writeCreate a permanent call

App

client.v1.app

methodscopesdescription
removeAuthorization-Unauthorize the app
uninstallApp-Uninstall the app
publishHomeViewchannels:writePublish home view

Files

client.v1.files

methodscopesdescription
fetchFilemessages:readFetch a file by URL

Scopes

The list of all available scopes:

namedescription
messages:readRead messages
messages:writeWrite messages
messages:editEdit messages
messages:deleteDelete messages
attachments:writeWrite attachments
user:readRead user profile
status:writeWrite user status
reaction:readReceive reactions
reaction:writeReact to messages
channels:listList channels
channels:readGet channel information
channels:writeWrite channels
users:listList all workspace users
workspace:readRead workspace information
calls:writeCreate permanent calls
files:writeWrite messages with files