Skip to content

Integration guide

Asklify + Flutter

Embed the hosted chat page in webview_flutter for a complete support experience, or build native UI over the REST API via your backend.

Prerequisite: an Asklify project with some knowledge added — the quickstart covers that in a couple of minutes. You'll need your public project ID (pub_...) from Widget → Install.
1

Add the dependency

terminal
flutter pub add webview_flutter
2

Add the chat screen

Push the widget below from a “Help” button anywhere in your app.

Ready-to-use template

Copy, paste, replace the project ID — that's the whole integration:

lib/support_chat_screen.dart
import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';

class SupportChatScreen extends StatefulWidget {
  const SupportChatScreen({super.key});

  @override
  State<SupportChatScreen> createState() => _SupportChatScreenState();
}

class _SupportChatScreenState extends State<SupportChatScreen> {
  late final WebViewController _controller;

  @override
  void initState() {
    super.initState();
    _controller = WebViewController()
      ..setJavaScriptMode(JavaScriptMode.unrestricted)
      ..loadRequest(Uri.parse('https://app.asklify.in/widget/pub_YOUR_PROJECT_ID'));
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Support')),
      body: WebViewWidget(controller: _controller),
    );
  }
}

Customization

All appearance and behavior — name, greeting, colors, theme, position, suggested questions — is configured in your dashboard under Widget settings and applies instantly without redeploying. See the widget configuration reference.

Event handling

To react to what happens in conversations — a chat starting, a customer requesting a human, feedback submitted — subscribe to webhooks. For fully custom experiences, the REST API exposes chat with streaming, knowledge search, and conversation transcripts.

Best practices

  • JavaScript must be enabled — the chat UI is a web app.
  • For native chat UI, proxy the REST /chat API through your backend; never embed sk_ keys in the app.
Never bundle a secret API key (sk_...) in a mobile app — extractable in minutes. Mobile apps should use the hosted chat page (as above) or talk to your own backend, which holds the key.

Troubleshooting

  • Blank screen on Android emulator — check the emulator has network access; cleartext isn't an issue since the chat URL is HTTPS.
  • iOS build error — ensure platform :ios, '12.0' or later in your Podfile.

Still stuck? Check the error reference or email hello@asklify.in.