Skip to main content

shotik 0.1.2 copy "shotik: ^0.1.2" to clipboard
shotik: ^0.1.2 copied to clipboard

Shotik SDK for Flutter. In-app support chat answered from Shotik and product analytics, with no third-party dependencies.

shotik (Flutter) #

Shotik's Support chat and Analytics for Flutter apps. Users write from your app and the conversation lands in Shotik's Support inbox on your Mac, where you or the AI answer; replies arrive live. Analytics records sessions, screens, taps (with rage and dead taps), scroll depth, errors, stalls, purchases and your own events, packed in the same wire format as the React Native and Swift SDKs.

  • Zero third-party dependencies: flutter only. HTTP and WebSocket use dart:io; the session token lives in the Keychain (iOS) or private app storage (Android) through a small native plugin.
  • Shotik.configure does no I/O. It stores the key and URL and returns; the modules start on the next event-loop turn. Calls made before it (an auth listener at startup, a push token on launch) are held and replayed in order.
  • Import only what you use: package:shotik/support.dart (client), support_ui.dart (client + widget), analytics.dart, or shotik.dart for everything.
  • Support: anonymous id that moves to the user on sign-in, optimistic sends with an offline queue that survives restarts, a live stream with backoff, receipts (sending, queued, sent, delivered, seen, failed), typing, quick replies, "Talk to a person", photos and screenshots, unread counts, push token.
  • The widget: a bottom sheet built from plain Flutter widgets (no Material or Cupertino look), a spring open and drag to dismiss, an optional launcher with an unread badge, light and dark, text scaling, semantics labels, RTL, English and Russian copy from the device locale.
  • Analytics: screens from a NavigatorObserver (MaterialApp, CupertinoApp, GoRouter), taps identified by widget names, keys and Semantics(identifier:), wireframes that never contain characters, ShotikMask for anything private, consent, one-line in_app_purchase wiring.
  • Flutter 3.24+ and Dart 3.5+. iOS 13+ as a Swift package (no CocoaPods); Android minSdk 21.

The full walkthrough, with troubleshooting, is in INTEGRATION.md. Русская версия: README.ru.md.

Quick start #

# flutter pub add shotik
dependencies:
  shotik: ^0.1.0
import 'package:shotik/shotik.dart';

void main() {
  Shotik.configure(appKey: 'spk_…', serverUrl: 'https://support.example.com');
  runApp(const ShotikRoot(child: MyApp()));
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) => MaterialApp(
        navigatorObservers: [ShotikAnalytics.navigatorObserver],
        builder: ShotikSupportWidget.builder(title: 'Walkito', quickReplies: const ['Billing', 'Report a bug']),
        home: const Home(),
      );
}

// Help row
onTap: () => ShotikSupport.open(),

// After your own sign-in / on sign-out
ShotikSupport.identify(userId: user.id, email: user.email, name: user.name);
ShotikAnalytics.identify(user.id);
ShotikSupport.reset();
ShotikAnalytics.reset();

The iOS app needs Swift Package Manager support enabled once on the machine that builds it: flutter config --enable-swift-package-manager.

API #

Shotik.configure(appKey:, serverUrl:, debug:) Once, as early as you like. No I/O on the calling isolate.
ShotikRoot(child:) Wrap the app once (around MaterialApp). Deep links, the screenshot boundary, the root that taps are described against, and the scroll layer.
ShotikSupportWidget.builder(...) For MaterialApp / CupertinoApp / WidgetsApp builder:. title, teamName, theme, launcher, launcherBottom (distance above the bottom safe area, to clear a bottom button or tab bar), quickReplies, locale.
ShotikSupport.open([conversationId]), close() Show or hide the sheet.
ShotikSupport.identify(userId:, name:, email:, attributes:), reset() Signed-in user / sign-out (new anonymous id).
ShotikSupport.setPushToken(token, platform:) APNs or FCM token; null clears it.
ShotikSupport.handleLink(uri) <scheme>://support opens the sheet. ShotikRoot already routes platform links here.
ShotikSupport.attachmentPicker Your image picker; with it set the attach menu offers "Photo". "Screenshot" needs nothing.
ShotikSupport.client, clientListenable The SupportClient: state (conversations, messages, unread, typing, status), send, retry, handoff.
ShotikAnalytics.navigatorObserver One per navigator. Starts analytics.
ShotikScreen(name:, child:) Names a screen explicitly (tabs, pages without a route name).
ShotikMask(child:) Hidden from tap labels and wireframes. Text fields are always masked.
ShotikAnalytics.track(name, props), screen(name), identify(userId, traits) Custom events, manual screens, the user.
ShotikAnalytics.purchase(...), watchPurchases(stream, products:) Purchases, by hand or from in_app_purchase.
ShotikAnalytics.enable(consent:, snapshots:, flushMs:, sessionTimeoutMs:, debug:) Options; optIn() / optOut() / setConsent().
ShotikAnalytics.flush(), reset(), ids Send now, new anonymous id, current ids.
ShotikSupportTheme Default
accent iOS blue Your bubbles, send button, launcher, links
onAccent white Text and glyphs on the accent
radius 18 Bubble radius; the sheet, chips and field follow it
fontFamily, fontFamilyBold system Regular and semibold families
brightness platform Force light or dark
light, dark ShotikColors overrides

Sample #

example/ is "Shotik Sample" (bundle id ai.shotik.sample.flutter, URL scheme shotiksampleflutter). See example/README.md.

Tests #

flutter analyze
flutter test

50 tests: the PROTOCOL.md section 9 conformance cases against a fake Shotik server, the packed batch compared byte for byte with the reference wire.ts output, the sheet (open, optimistic send, receipts, typing, quick replies, light and dark, 2x text, Russian copy), tap identity and wireframes, and [perf] timings for configure, batch encoding and tap description.

0
likes
160
points
0
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Shotik SDK for Flutter. In-app support chat answered from Shotik and product analytics, with no third-party dependencies.

Repository (GitHub)
View/report issues

Topics

#support #chat #analytics #customer-support

License

MIT (license)

Dependencies

flutter

More

Packages that depend on shotik

Packages that implement shotik