Meta now charges per message, not per conversation — and those charges never pass through us. See what that means 
VartaAPI

VartaAPI Desk · iPhone

Your chat, inside your iPhone app.

The same chat, help centre and tickets as on your website, drawn with Apple’s own screens, in your colour. One Swift package and a few lines of code. Make a free account first.

Step 1

Add the package

In Xcode, open the File menu, then Add Package Dependencies…, paste the address below, choose Up to Next Major Version from 1.0.0, and add the VartaDesk library to your app. It brings no other libraries.

https://github.com/vartaapi/vartadesk-ios
Step 2

Start it when your app starts

Your workspace ID is on the Website chat page in VartaAPI (it starts with ws_). It is not a secret.

import VartaDesk

func application(_ application: UIApplication,
                 didFinishLaunchingWithOptions options: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    VartaDesk.setup(workspace: "ws_xxxxxxxxxx")
    return true
}
Step 3

Open the chat

From your own Help button or menu, or with our round chat button in the corner of any screen. Both show the unread count of replies.

// From any button: Home (the conversation, help, tickets)
VartaDesk.open()
// or straight into the conversation
VartaDesk.openChat()

// Or our chat button, in a screen's viewDidLoad
VartaDesk.showChatButton(in: self)

// Or a badge of your own
VartaDesk.setUnreadListener { count in badge.text = "\(count)" }
Step 4

Tell it who is signed in

Then your team sees the person as Verified, and their chat follows them to your website and to every phone. userHash is made on your server with the secret under Safety on the Website chat page, the same as for your website. Never put the secret in the app.

// After sign-in (userHash comes from your server)
VartaDesk.login(VartaDeskUser(userId: user.id, userHash: hash, name: user.name, email: user.email))

// On sign-out, so the next person on the phone starts fresh
VartaDesk.logout()

// On your server (Node.js)
const userHash = crypto.createHmac("sha256", process.env.VARTA_DESK_SECRET)
  .update(String(user.id)).digest("hex");
Step 5

Photos from the camera

Choosing photos and files works as it is, with Apple’s own pickers and no permission asked. For Take a photo, add a camera line to your app’s Info.plist; without it the chat says the camera isn’t set up.

<key>NSCameraUsageDescription</key>
<string>To send a photo to our support team in the chat.</string>
Step 6

Notifications for replies

They come from your own app, through Apple, with your own push key. In your Apple Developer account, make a key with Apple Push Notifications service ticked. In VartaAPI, open Website chat, then Notifications on the phone (iPhone chat kit), and paste the key file with its Key ID, your Team ID and your app’s bundle ID. Then hand the kit the phone’s token and the notifications.

// AppDelegate (and set UNUserNotificationCenter.current().delegate = self)
func application(_ app: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken token: Data) {
    VartaDesk.setPushToken(token)
}

func userNotificationCenter(_ c: UNUserNotificationCenter, willPresent n: UNNotification) async
    -> UNNotificationPresentationOptions {
    VartaDesk.presentationOptions(for: n) ?? [.banner, .sound]   // not while the chat is open
}

func userNotificationCenter(_ c: UNUserNotificationCenter, didReceive r: UNNotificationResponse) async {
    if VartaDesk.handleNotificationTap(r) { return }   // a reply: opens the chat
    // ...your own notifications
}

// Once, after asking the person for notifications
UIApplication.shared.registerForRemoteNotifications()
Good to know
Works on
iPhone and iPad, iOS 15 and up
Size
A Swift package with no other libraries
Permissions
None for chat, photos and files. The camera needs your app's camera line
Inside
Chat, help search and articles, tickets, photos and files, unread count, notifications
Plans
Every VartaAPI Desk plan, Hello (free) included
Code
Open source, MIT licence, on GitHub

Version 1.0.0. The code and a small sample app are at github.com/vartaapi/vartadesk-ios. Android app too? The Android guide. No native app? Any app can open the chat as a web page: the address is on the Website chat page in VartaAPI, under Chat inside your mobile app.