# ScriptRunner Connect Managed API for Slack
Managed API for Slack is an API Client for Slack by [Adaptavist](https://www.adaptavist.com/). You can read more about Managed APIs [here](https://docs.adaptavist.com/src/managed-apis).

This is [ScriptRunner Connect](https://scriptrunnerconnect.com) runtime specific version of the Managed API (with `sr-connect` suffix). If you want to use Managed API in any other runtime, have a look at the [runtime agnostic version](https://www.npmjs.com/package/@managed-api/slack-core).

# Supported API calls
- [fetch](https://docs.adaptavist.com/src/managed-apis/managed-api-abstractions)
- Admin
    - Users
        - [assignUser](https://api.slack.com/methods/admin.users.assign)
        - [getUsers](https://api.slack.com/methods/admin.users.list)
        - [inviteUser](https://api.slack.com/methods/admin.users.invite)
        - [removeUser](https://api.slack.com/methods/admin.users.remove)
        - [setAdmin](https://api.slack.com/methods/admin.users.setAdmin)
        - [setExpiration](https://api.slack.com/methods/admin.users.setExpiration)
        - [setOwner](https://api.slack.com/methods/admin.users.setOwner)
        - [setRegular](https://api.slack.com/methods/admin.users.setRegular)
- Bot
    - [getInfo](https://api.slack.com/methods/bots.info)
- Chat
    - [deleteMessage](https://api.slack.com/methods/chat.delete)
    - [deleteScheduledMessage](https://api.slack.com/methods/chat.deleteScheduledMessage)
    - [getPermalink](https://api.slack.com/methods/chat.getPermalink)
    - [getScheduledMessages](https://api.slack.com/methods/chat.scheduledMessages.list)
    - [postEphemeralMessage](https://api.slack.com/methods/chat.postEphemeral)
    - [postMeMessage](https://api.slack.com/methods/chat.meMessage)
    - [postMessage](https://api.slack.com/methods/chat.postMessage)
    - [scheduleMessage](https://api.slack.com/methods/chat.scheduleMessage)
    - [unfurlMessage](https://api.slack.com/methods/chat.unfurl)
    - [updateMessage](https://api.slack.com/methods/chat.update)
- Conversation
    - [archiveConversation](https://api.slack.com/methods/conversations.archive)
    - [closeConversation](https://api.slack.com/methods/conversations.close)
    - [createConversation](https://api.slack.com/methods/conversations.create)
    - [getConversations](https://api.slack.com/methods/conversations.list)
    - [getHistory](https://api.slack.com/methods/conversations.history)
    - [getInfo](https://api.slack.com/methods/conversations.info)
    - [getMembers](https://api.slack.com/methods/conversations.members)
    - [getReplies](https://api.slack.com/methods/conversations.replies)
    - [inviteUser](https://api.slack.com/methods/conversations.invite)
    - [joinConversation](https://api.slack.com/methods/conversations.join)
    - [kickUser](https://api.slack.com/methods/conversations.kick)
    - [leaveConversation](https://api.slack.com/methods/conversations.leave)
    - [openConversation](https://api.slack.com/methods/conversations.open)
    - [renameConversation](https://api.slack.com/methods/conversations.rename)
    - [setPurpose](https://api.slack.com/methods/conversations.setPurpose)
    - [setTopic](https://api.slack.com/methods/conversations.setTopic)
    - [unarchiveConversation](https://api.slack.com/methods/conversations.unarchive)
- Dialog
    - [openDialog](https://api.slack.com/methods/dialog.open)
- Dnd
    - [endDnd](https://api.slack.com/methods/dnd.endDnd)
    - [endSnooze](https://api.slack.com/methods/dnd.endSnooze)
    - [getInfo](https://api.slack.com/methods/dnd.info)
    - [getTeamInfo](https://api.slack.com/methods/dnd.teamInfo)
    - [setSnooze](https://api.slack.com/methods/dnd.setSnooze)
- Emoji
    - [getEmojis](https://api.slack.com/methods/emoji.list)
- File
    - [completeFileUpload](https://api.slack.com/methods/files.completeUploadExternal)
    - [deleteFile](https://api.slack.com/methods/files.delete)
    - [getFiles](https://api.slack.com/methods/files.list)
    - [getFileUploadUrl](https://api.slack.com/methods/files.getUploadURLExternal)
    - [getInfo](https://api.slack.com/methods/files.info)
    - [uploadFile](https://api.slack.com/methods/files.upload)
    - Comment
        - [deleteComment](https://api.slack.com/methods/files.comments.delete)
    - PublicUrl
        - [createPublicUrl](https://api.slack.com/methods/files.sharedPublicURL)
        - [revokePublicUrl](https://api.slack.com/methods/files.revokePublicURL)
    - Remote
        - [addFile](https://api.slack.com/methods/files.remote.add)
        - [getFiles](https://api.slack.com/methods/files.remote.list)
        - [getInfo](https://api.slack.com/methods/files.remote.info)
        - [removeFile](https://api.slack.com/methods/files.remote.remove)
        - [shareFile](https://api.slack.com/methods/files.remote.share)
        - [updateFile](https://api.slack.com/methods/files.remote.update)
- Pins
    - [addPin](https://api.slack.com/methods/pins.add)
    - [getPins](https://api.slack.com/methods/pins.list)
    - [removePin](https://api.slack.com/methods/pins.remove)
- Reaction
    - [addReaction](https://api.slack.com/methods/reactions.add)
    - [getReaction](https://api.slack.com/methods/reactions.get)
    - [getReactions](https://api.slack.com/methods/reactions.list)
    - [removeReaction](https://api.slack.com/methods/reactions.remove)
- Reminders
    - [addReminder](https://api.slack.com/methods/reminders.add)
    - [completeReminder](https://api.slack.com/methods/reminders.complete)
    - [deleteReminder](https://api.slack.com/methods/reminders.delete)
    - [getInfo](https://api.slack.com/methods/reminders.info)
    - [getReminders](https://api.slack.com/methods/reminders.list)
- Reply
    - [postMessage](undefined)
- Search
    - [searchMessages](https://api.slack.com/methods/search.messages)
- Team
    - [getAccessLogs](https://api.slack.com/methods/team.accessLogs)
    - [getBillableInfo](https://api.slack.com/methods/team.billableInfo)
    - [getInfo](https://api.slack.com/methods/team.info)
    - [getIntegrationLogs](https://api.slack.com/methods/team.integrationLogs)
    - Profile
        - [getProfile](https://api.slack.com/methods/team.profile.get)
- User
    - [getConversations](https://api.slack.com/methods/users.conversations)
    - [getIdentity](https://api.slack.com/methods/users.identity)
    - [getInfo](https://api.slack.com/methods/users.info)
    - [getPresence](https://api.slack.com/methods/users.getPresence)
    - [getUserByEmail](https://api.slack.com/methods/users.lookupByEmail)
    - [getUsers](https://api.slack.com/methods/users.list)
    - [setPresence](https://api.slack.com/methods/users.setPresence)
    - Profile
        - [getProfile](https://api.slack.com/methods/users.profile.get)
        - [setProfile](https://api.slack.com/methods/users.profile.set)
- UserGroup
    - [createUserGroup](https://api.slack.com/methods/usergroups.create)
    - [disableUserGroup](https://api.slack.com/methods/usergroups.disable)
    - [enableUserGroup](https://api.slack.com/methods/usergroups.enable)
    - [getUserGroups](https://api.slack.com/methods/usergroups.list)
    - [updateUserGroup](https://api.slack.com/methods/usergroups.update)
    - User
        - [getUsers](https://api.slack.com/methods/usergroups.users.list)
        - [updateUsers](https://api.slack.com/methods/usergroups.users.update)
- View
    - [openView](https://api.slack.com/methods/views.open)
    - [publishView](https://api.slack.com/methods/views.publish)
    - [pushView](https://api.slack.com/methods/views.push)
    - [updateView](https://api.slack.com/methods/views.update)


# Constructing Managed API
In ScriptRunner Connect a Managed API is constructed for you, but if you need to construct it manually, here's how you can do it:
```typescript
import { SlackApi } from '@managed-api/slack-sr-connect';

export default async function() {
    const api = new SlackApi('API_CONNECTION_ID');
}
```

# Contact
Feel free to drop ideas, suggestions or improvements into our [Community hub](https://loop.scriptrunnerhq.com/c/integration-forum).

 # Changelog
# 2.4.0

- # Added files.getUploadURLExternal method (getFileUploadUrl).
- # Added files.completeUploadExternal method (completeFileUpload).
- # Deprecated files.upload method (uploadFile).

# 2.2.0

- # Removed non-empty body from HEAD requests.

# 2.1.0

- # Fix header for View group methods.

# 2.0.0

- # Breaking change: URL and query string parameters are now URL encoded, meaning if you encoded them explicitly before you have to remove your own encoding, otherwise they will get double encoded.

# 0.1.0

Copyright Adaptavist 2025 (c) All rights reserved