Skip to main content

truhuddle_widget 1.0.0 copy "truhuddle_widget: ^1.0.0" to clipboard
truhuddle_widget: ^1.0.0 copied to clipboard

Native TruHuddle customer support for Flutter with live messaging, AI agents, voice notes and workspace-controlled permissions.

example/lib/main.dart

import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'package:truhuddle_widget/truhuddle_widget.dart';

void main() => runApp(const MaterialApp(home: SupportExample()));

class SupportExample extends StatelessWidget {
  const SupportExample({super.key});
  @override
  Widget build(BuildContext context) => Scaffold(
    appBar: AppBar(title: const Text('TruHuddle Widget')),
    body: Center(
      child: FilledButton(
        onPressed: () => TruhuddleWidget.open(
          context,
          options: TruhuddleOptions(
            // Public identifiers only. Replace these for your workspace and app.
            appId: const String.fromEnvironment(
              'TRUHUDDLE_APP_ID',
              defaultValue:
                  'appid_000000000000000000000000000000000000000000000000',
            ),
            packageName: const String.fromEnvironment(
              'TRUHUDDLE_PACKAGE_NAME',
              defaultValue: 'com.example.app',
            ),
            getSession: () async {
              // Your backend must authenticate the app user and choose their ID.
              // Use your normal app login token here, never a TruHuddle secret key.
              final response = await http
                  .post(
                    Uri.parse(
                      const String.fromEnvironment(
                        'SUPPORT_SESSION_ENDPOINT',
                        defaultValue: 'https://api.example.com/support-session',
                      ),
                    ),
                    headers: {
                      'Authorization':
                          'Bearer ${const String.fromEnvironment('EXAMPLE_APP_LOGIN_TOKEN')}',
                    },
                  )
                  .timeout(const Duration(seconds: 15));
              if (response.statusCode != 200)
                throw const TruhuddleException('Sign in to contact support.');
              return TruhuddleSession.fromJson(
                jsonDecode(response.body) as Map<String, dynamic>,
              );
            },
          ),
        ),
        child: const Text('Contact support'),
      ),
    ),
  );
}
0
likes
0
points
1.14k
downloads

Publisher

unverified uploader

Weekly Downloads

Native TruHuddle customer support for Flutter with live messaging, AI agents, voice notes and workspace-controlled permissions.

Homepage
Repository (GitHub)
View/report issues

Funding

Consider supporting this project:

truhuddle.com

License

unknown (license)

Dependencies

audio_waveforms, flutter, http, hugeicons, image_picker, path_provider, url_launcher, uuid

More

Packages that depend on truhuddle_widget