The iOS SDK
CrmSdk puts PurrCRM inside your iOS app. It is a Swift package with no dependencies: it talks to PurrCRM and keeps the state. Your app either draws every screen in its own look, with UIKit or SwiftUI, or adds the built-in screens, which draw the messenger and your in-app messages over your app for you.
What it does for you:
- In-app messages: it checks in for the banners, posts, carousels and surveys your team writes, keeps them in the order and at the pace PurrCRM wants, and sends back what people did with each.
- The messenger: conversations with your team, kept current while one is on screen, pictures, ratings, a help bot, and the user’s tickets.
- The help center: your articles, their collections and a search.
- Product events: the app opening and closing, screens, permission changes, taps on pushes and links, sent in batches by themselves, plus events of your own.
- Pushes: it registers the phone’s Firebase token for each user, recognises PurrCRM‘s pushes, keeps the unread counts right, and opens the place a tapped push names. Every push is also kept in an inbox of notices.
- Links: Universal Links that open a place in your app, saved links with their data, links through an install, and links your users share.
- Preferences: the topics people hear about, by channel, and their consent to offers by push.
What you draw
Section titled “What you draw”The SDK gives you state to watch and calls to make; the screens are yours.
| Part | What the SDK gives you | What you draw |
|---|---|---|
| Messenger | crm.messenger.state, load(), refresh(), loadMore(), crm.unread | the home, the list of conversations, the badge |
| A conversation | crm.conversation(id), crm.newConversation(), crm.ticketConversation(id): a ConversationSession with state, send, addPicture, answerBot, rate | the thread and the composer |
| Tickets | crm.tickets.list(), get(id), write(...) | the list and a ticket |
| Help center | crm.help.collections(), collection, featured, search, article, rate | the pages |
| In-app messages | crm.inApp.next, crm.inApp.banner, shown, clicked, dismissed, completed, closed; crm.inApp.survey(m), crm.inApp.carousel(m) | banners, posts, surveys, carousels |
| Inbox | crm.notices, refreshNotices(), moreNotices(), markNoticesRead(_:) | the bell and the list |
| Preferences | crm.preferences(wording:): load(), choose(...), turnAllOff() | the switches |
| Failures | tellCrmFailure(error, attempt:), which answers a CrmSentence | the words, in your app’s languages |
Everything the SDK keeps for your screens is a CrmValue: read .value, or observe it and redraw. A screen in UIKit:
import CrmSdkimport UIKit
final class MessengerViewController: UITableViewController { private var watching: [CrmCancellable] = [] private var state = MessengerState()
override func viewDidLoad() { super.viewDidLoad() watching.append(crm.messenger.state.observe { [weak self] state in self?.state = state self?.tableView.reloadData() // your own cells, in your own look }) Task { await crm.messenger.load() } }}The one view the SDK has is the setup check, a developer’s panel over your app that says what is set up and what is not. It shows only when you turn on debug (The setup check).
Your app stays in charge of signing people in, Firebase and the push permission, picking pictures, and navigation. Each of those is a call you make or a hook you hand to the SDK.
Requirements
Section titled “Requirements”- iOS 13 or later. Swift 6 tools (Xcode 16 or later); your app may use the Swift 5 or the Swift 6 language mode.
- Your PurrCRM address,
https://app.purrcrm.com, and your app’s key, from the App key card on Settings › your app › Developers › Install. - A backend that signs a short token for your signed-in users (Sign users in).
- For pushes: Firebase Cloud Messaging in your app, and your Apple push key in your Firebase project (Push).
Where to start
Section titled “Where to start”The general setup guide walks through what your team does on PurrCRM‘s website. In the app:
- Install the package.
- Initialise it at launch.
- Sign users in.
- Set up push.
- Check it works: turn on
debugand read the setup check. On PurrCRM, the overview’s setup checklist ticks Install the SDK in a build when the first request from your app arrives, and names the SDK it saw (such as “iOS 0.2.0”). Settings › your app › Developers › Install › What your app sees shows what the SDK reads of your app.
Then add what you need: links, the messenger, the help center, in-app messages, events, preferences and test mode. Every public type is listed in API at a glance.