Install the SDK, configure it at launch, identify signed-in users, and connect your subscriptions. Or copy the prompt and let your AI coding agent do it.
Paste this into Claude Code, Cursor, Codex or any coding agent that can edit your project. Replace pk_live_YOUR_KEY with the public SDK key from Settings → SDK keys. Review the changes before you ship them.
Install the Snag SDK in this mobile app. 1. Work out the platform: native iOS (Swift), native Android (Kotlin), React Native, Expo or Flutter. Docs: https://snag.cx/docs 2. Add the Snag SDK for that platform. 3. Configure it once at launch with my public SDK key, pk_live_YOUR_KEY (Snag dashboard → Settings → SDK keys): - iOS: Snag.configure(appKey: "pk_live_YOUR_KEY") in App.init or application(_:didFinishLaunchingWithOptions:) - Android: Snag.configure(this, "pk_live_YOUR_KEY") in Application.onCreate 4. After the user logs in, call identify with their user ID and a userHash: HMAC-SHA256 of the user ID with the Snag identity secret, computed on our server and returned to the app. Never put the identity secret in the app. Pass email and name if the app has them. - iOS: Snag.identify(userId:userHash:traits:) - Android: Snag.identify(userId, userHash = …, traits = SnagTraits(…)) 5. Call Snag.logout() when the user logs out. 6. Add a "Help" or "Contact us" entry that opens the messenger with Snag.presentMessenger(). 7. If the app sells subscriptions, pass Snag.appAccountToken as appAccountToken (StoreKit) or obfuscatedAccountId (Play Billing) when starting a purchase. Don't change unrelated code. When you're done, show me the changes and list anything I still need to set up in the Snag dashboard.
Swift Package, iOS 15 and later, no dependencies. In Xcode, choose File → Add Package Dependencies and add the Snag library to your app target.
import Snag
// On launch (App.init or application(_:didFinishLaunchingWithOptions:))
Snag.configure(appKey: "pk_live_…")
// After your user signs in
Snag.identify(userId: user.id,
userHash: user.snagHash,
traits: SnagTraits(email: user.email, name: user.name))
// Open the messenger from a Help button
Snag.presentMessenger()
// On sign out
Snag.logout()Kotlin with Jetpack Compose UI, Android 8.0 (API 26) and later.
// Application.onCreate
Snag.configure(this, "pk_live_…")
// After your user signs in
Snag.identify(user.id, userHash = user.snagHash,
traits = SnagTraits(email = user.email))
// Open the messenger from a Help button
Snag.presentMessenger(activity)
// On sign out
Snag.logout()The snag_flutter plugin wraps the native SDKs, so the messenger, help center and cancel flow are the same native screens. iOS 15+ with Swift Package Manager, Android 8.0 (API 26) and later.
import 'package:snag_flutter/snag_flutter.dart';
// In main(), before runApp
await Snag.configure('pk_live_…');
// After your user signs in
await Snag.identify(user.id, userHash: user.snagHash,
traits: SnagTraits(email: user.email));
// Open the messenger from a Help button
Snag.presentMessenger();
// On sign out
await Snag.logout();userHash proves a user ID came from your app. Compute it on your server as HMAC-SHA256 of the user ID, keyed with the identity secret from Settings → SDK keys, as a hex string. Send it to the app with the signed-in user. Never put the identity secret in the app itself.
import { createHmac } from "node:crypto";
const snagHash = createHmac("sha256", process.env.SNAG_IDENTITY_SECRET)
.update(user.id)
.digest("hex");Connect the App Store and Google Play in Settings → Store connections, or connect RevenueCat, Superwall or Adapty in Settings → Integrations. The SDK reports each purchase and links it to the signed-in user.
If you start purchases yourself, pass Snag.appAccountToken as StoreKit’s appAccountToken or Play Billing’s obfuscatedAccountId. Then store notifications match the right person even before the app reports the purchase.
let options: Set<Product.PurchaseOption> =
Snag.appAccountToken.map { [.appAccountToken($0)] } ?? []
let result = try await product.purchase(options: options)The SDKs never block your app or throw at it. Every call returns immediately and does its network work in the background; failures go to the optional completion callback.
Snag runs an MCP server, so any agent that speaks the Model Context Protocol can work your inbox and churn moments. Create a secret key in Settings → SDK keys. Each key gives access to one app. Keep it on your server or in your agent’s config, never in your app.
claude mcp add --transport http snag https://api.snag.cx/mcp \ --header "Authorization: Bearer sk_live_YOUR_SECRET_KEY"
{
"mcpServers": {
"snag": {
"url": "https://api.snag.cx/mcp",
"headers": { "Authorization": "Bearer sk_live_YOUR_SECRET_KEY" }
}
}
}Your agent gets these tools:
search_usersFind users by name, email or user idget_userProfile, subscription and recent eventslist_conversationsSupport conversations, newest firstread_conversationA conversation’s full historyreplyAnswer in-app, with push if they’re offlinetrack_eventTrack an event, which can start workflowslist_segmentsSegments with live user countslist_workflowsWorkflows with enrollment and conversionssearch_help_centerSearch published help-center articlesAgents can’t give refunds, change plans or delete data through Snag. Those stay with your team.
The @snag/react-native package wraps the native SDKs, so the messenger, help center and cancel flow are the same native screens. It works in Expo apps (with a development build, not Expo Go) and in bare React Native apps that have Expo modules installed. iOS 16.4+, Android 8.0 (API 26) and later.
"plugins": ["@snag/react-native"]
import Snag from '@snag/react-native';
// Once, when the app starts
await Snag.configure('pk_live_…');
// After your user signs in
await Snag.identify(user.id, { userHash: user.snagHash,
traits: { email: user.email } });
// Open the messenger from a Help button
Snag.presentMessenger();
// On sign out
await Snag.logout();