Connect to the Slack Real Time Messaging API
Swift Ruby
Clone or download
Failed to load latest commit information.
SKRTMAPI.xcodeproj VaporEngineRTM improvements Feb 8, 2018
Sources/SKRTMAPI No need to escape for RTM API Mar 10, 2018
Supporting Files Version number bumps Feb 8, 2018
.gitignore Add .gitignore Jun 10, 2017
.swift-version vapor/engine Feb 8, 2018
.swiftlint.yml Swift 4 Feb 2, 2018
Cartfile Swift 4 Feb 2, 2018
LICENSE Initial commit Mar 11, 2017
Package.swift Swift 4 Feb 2, 2018
Podfile Fix podfile Jul 14, 2017 Swift 4 Feb 2, 2018
SKRTMAPI.podspec Bump podspec Mar 28, 2018

SKRTMAPI: SlackKit RTM Module

Swift Version Plaforms License MIT SwiftPM compatible Carthage compatible CocoaPods compatible

A module for connecting to the Slack Real Time Messaging API.



Add SKRTMAPI to your pod file:


and run

# Use CocoaPods version >= 1.4.0
pod install


Add SKRTMAPI to your Cartfile:

github "SlackKit/SKRTMAPI"

and run

carthage bootstrap

Drag the built SKRTMAPI.framework into your Xcode project.

Swift Package Manager

Add SKRTMAPI to your Package.swift

import PackageDescription
let package = Package(
	dependencies: [
		.package(url: "", .upToNextMinor(from: "4.1.0"))

Run swift build on your application’s main directory.

To use the library in your project import it:



Initialize an instance of SKRTMAPI with a Slack auth token:

let rtm = SKRTMAPI(token: "xoxb-SLACK_AUTH_TOKEN")

If your bot doesn't need any state information when you connect, pass false for the withInfo parameter:

let rtm = SKRTMAPI(token: "xoxb-SLACK_AUTH_TOKEN")
rtm.connect(withInfo: false)

Customize the connection with RTMOptions:

let options = RTMOptions(simpleLatest: false, noUnreads: false, mpimAware: true, pingInterval: 30, timeout: 300, reconnect: true)
let rtm = SKRTMAPI(token: "xoxb-SLACK_AUTH_TOKEN", options: options)

Provide your own web socket implementation by conforming to RTMWebSocket:

public protocol RTMWebSocket {
    var delegate: RTMDelegate? { get set }
    func connect(url: URL)
    func disconnect()
    func sendMessage(_ message: String) throws
let rtmWebSocket = YourRTMWebSocket()
let rtm = SKRTMAPI(token: "xoxb-SLACK_AUTH_TOKEN", rtm: rtmWebSocket)