DeewanDocs
API keys

Mobile apps

Deewan in React Native, Flutter, and native iOS and Android apps — embedded in one component, or with your own interface.

Two ways to put a meeting in your app. Embed shows Deewan's own meeting — every feature, end-to-end encrypted, in the person's language — from a join link. Custom joins with a token and gives you participants, video tracks, chat and reactions to draw your own screens. People in apps and in browsers are in the same meeting either way.

Never ship an API key in an app. Your server creates the join link (POST /rooms/{id}/join-links) or token (POST /rooms/{id}/tokens) for the signed-in person and returns only that.

EmbedCustom
From your serverA join linkA token
InterfaceDeewan's, with every featureYours
Strict roomsYesYes — send the SDK's exchangeKey() with the token request
Expo GoYesNo — needs a development build

Set a redirect_url on the join link (for example https://app.example.com/meeting-done). When the person leaves or the meeting ends, the embedded view doesn't open it — it tells your app, so you can close the screen.

React Native and Expo

bash
# Expo
npx expo install @deewanio/react-native react-native-webview
# React Native CLI
npm install @deewanio/react-native react-native-webview && npx pod-install
Embed
import { DeewanMeetingView, requestMeetingPermissions } from "@deewanio/react-native";

export function MeetingScreen({ joinUrl, onClose }: { joinUrl: string; onClose: () => void }) {
  const [ready, setReady] = useState(false);
  useEffect(() => {
    requestMeetingPermissions().then(() => setReady(true));
  }, []);
  if (!ready) return null;
  return <DeewanMeetingView joinUrl={joinUrl} onExit={onClose} onError={onClose} />;
}

Add camera and microphone permissions: on iOS NSCameraUsageDescription and NSMicrophoneUsageDescription (in Expo, ios.infoPlist in app.json); on Android CAMERA, RECORD_AUDIO and MODIFY_AUDIO_SETTINGS. The view only loads links on deewan.io and grants the camera and microphone to Deewan alone.

Custom — install
npx @deewanio/react-native setup
# add "@deewanio/react-native" to "plugins" in app.json,
# then make a development build: npx expo run:ios / npx expo run:android
Custom
import { joinMeeting, setupDeewan, VideoView, type Meeting } from "@deewanio/react-native/custom";

setupDeewan(); // once, when the app starts

// Your server calls POST /rooms/{id}/tokens and returns the result.
const t = await fetch("https://app.example.com/api/meeting-token").then((r) => r.json());
const meeting: Meeting = await joinMeeting(
  { serverUrl: t.server_url, token: t.token, e2eePassphrase: t.e2ee_passphrase },
  { publish: { microphone: true, camera: true } },
);

meeting.on("participants", (people) => setPeople(people));
meeting.on("message", ({ name, text }) => addChat(name, text));
// For each person:
<VideoView videoTrack={meeting.videoTrack(person.id)} style={{ flex: 1 }} />;
// Later:
await meeting.leave();

Flutter

bash
flutter pub add deewan
Embed
import 'package:deewan/deewan.dart';

// Ask for camera and microphone first on Android (for example with permission_handler).
Navigator.of(context).push(MaterialPageRoute(
  builder: (context) => Scaffold(
    body: SafeArea(
      child: DeewanMeetingView(
        joinUrl: joinUrl, // from your server
        onExit: (_) => Navigator.of(context).pop(),
        onError: (_) => Navigator.of(context).pop(),
      ),
    ),
  ),
));
Custom
import 'package:deewan/custom.dart';

final meeting = await DeewanMeeting.join(
  MeetingCredentials.fromJson(tokenResponseFromYourServer),
  microphone: true,
  camera: true,
);

// meeting.room changes as people come, go, mute and speak.
ListenableBuilder(
  listenable: meeting.room,
  builder: (context, _) => GridView.count(
    crossAxisCount: 2,
    children: [
      for (final person in meeting.participants)
        if (meeting.videoTrack(person.id) case final track?) VideoTrackRenderer(track) else Center(child: Text(person.name)),
    ],
  ),
);

meeting.messages.listen((m) => print('${m.name}: ${m.text}'));
await meeting.sendMessage('Hello');
await meeting.leave();

Permissions: iOS NSCameraUsageDescription and NSMicrophoneUsageDescription in Info.plist; Android CAMERA, RECORD_AUDIO, MODIFY_AUDIO_SETTINGS and INTERNET in AndroidManifest.xml.

Chat and calls

Messaging and ringing voice and video calls between your users, with your own screens. Your server returns a short-lived user token for the signed-in person; the app connects with it. Messaging needs no native setup (it works in Expo Go); a call's audio and video use the custom-interface setup above. Full guide: Chat and calls.

React Native
import { connectChat } from "@deewanio/react-native/chat";
import { joinCall } from "@deewanio/react-native/custom";

const chat = await connectChat(() => api.post("/deewan/token").then((r) => r.token));
chat.on("message", (m) => addMessage(m));
chat.on("call", (call) => {
  if (call.status === "ringing" && call.created_by !== chat.me.id) showIncomingCall(call);
});

const dm = await chat.channels.create({ kind: "direct", members: ["user_456"] });
await chat.messages.send(dm.id, { text: "مرحبا" });
const meeting = await joinCall(chat, await chat.calls.start({ channel_id: dm.id, kind: "video" }));
Flutter
import 'package:deewan/chat.dart';
import 'package:deewan/custom.dart';

final chat = await DeewanChat.connect(() => api.deewanToken());
chat.messages.listen(addMessage);
chat.calls.listen((call) {
  if (call.status == 'ringing' && call.createdBy != chat.me.id) showIncomingCall(call);
});

final dm = await chat.createChannel(kind: 'direct', members: ['user_456']);
await chat.send(dm.id, text: 'مرحبا');
final meeting = await joinCall(chat, await chat.startCall(channelId: dm.id));

The live connection runs while the app is open. To ring a phone whose app is closed, send a push notification from your server when the call.ringing webhook arrives.

Native iOS and Android

Embed the join link in the system web view. Keep it on deewan.io, give the camera and microphone to Deewan only, and close the screen when it tries to leave (your redirect_url).

iOS — WKWebView (iOS 15+)
import UIKit
import WebKit

final class MeetingViewController: UIViewController, WKNavigationDelegate, WKUIDelegate {
    private let joinURL: URL // from your server
    init(joinURL: URL) { self.joinURL = joinURL; super.init(nibName: nil, bundle: nil) }
    required init?(coder: NSCoder) { fatalError() }

    override func loadView() {
        let config = WKWebViewConfiguration()
        config.allowsInlineMediaPlayback = true
        config.mediaTypesRequiringUserActionForPlayback = []
        let web = WKWebView(frame: .zero, configuration: config)
        web.navigationDelegate = self
        web.uiDelegate = self
        view = web
        web.load(URLRequest(url: joinURL))
    }

    // Camera and microphone for Deewan only.
    func webView(_ webView: WKWebView, requestMediaCapturePermissionFor origin: WKSecurityOrigin,
                 initiatedByFrame frame: WKFrameInfo, type: WKMediaCaptureType,
                 decisionHandler: @escaping (WKPermissionDecision) -> Void) {
        decisionHandler(origin.protocol == "https" && origin.host == "deewan.io" ? .grant : .deny)
    }

    // Anywhere but Deewan (your redirect_url) ends the meeting screen.
    func webView(_ webView: WKWebView, decidePolicyFor action: WKNavigationAction,
                 decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
        let url = action.request.url
        if url?.host == "deewan.io" || ["about", "blob", "data"].contains(url?.scheme ?? "") {
            decisionHandler(.allow)
            return
        }
        decisionHandler(.cancel)
        if action.targetFrame?.isMainFrame == true { dismiss(animated: true) }
    }
}
Android — WebView
class MeetingActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        // Request CAMERA and RECORD_AUDIO before opening this screen.
        val web = WebView(this)
        setContentView(web)
        web.settings.javaScriptEnabled = true
        web.settings.domStorageEnabled = true
        web.settings.mediaPlaybackRequiresUserGesture = false
        web.settings.allowFileAccess = false

        // Camera and microphone for Deewan only.
        web.webChromeClient = object : WebChromeClient() {
            override fun onPermissionRequest(request: PermissionRequest) {
                val deewan = request.origin.scheme == "https" && request.origin.host == "deewan.io"
                val media = request.resources.all {
                    it == PermissionRequest.RESOURCE_VIDEO_CAPTURE || it == PermissionRequest.RESOURCE_AUDIO_CAPTURE
                }
                if (deewan && media) request.grant(request.resources) else request.deny()
            }
        }
        // Anywhere but Deewan (your redirect_url) ends the meeting screen.
        web.webViewClient = object : WebViewClient() {
            override fun shouldOverrideUrlLoading(view: WebView, request: WebResourceRequest): Boolean {
                if (request.url.host == "deewan.io") return false
                if (request.isForMainFrame) finish()
                return true
            }
        }
        web.loadUrl(requireNotNull(intent.getStringExtra("joinUrl"))) // from your server
    }
}

The embedded meeting above is the supported path in Swift and Kotlin today. Native Deewan SDKs for iOS and Android, for an interface of your own, are on the way: write to support@deewan.io for early access.