ابرووا
شروع رایگان
☰ فهرست مستندات · شروع سریع
به‌زودی. Abrova Chat به‌زودی فعال می‌شود. این صفحه توضیح می‌دهد چطور کار خواهد کرد؛ هنوز قابل استفاده نیست.
این صفحه هنوز ترجمه نشده — نسخه‌ی انگلیسی نمایش داده می‌شود. English

Quick Start

Get Abrova Chat running in your app in under 5 minutes — install, initialize, connect to realtime. Flutter, iOS, Android, React Native, Web, Node.js, REST.

Coming soonبه‌روزرسانی: ۵ آبان ۱۴۰۵

Get AbrovaChat running in your app in under 5 minutes. Pick your platform and follow the steps.

Every client platform ships two packages: a headless core SDK and an optional UI package with pre-built components. The Node.js SDK is server-side only; REST is for any HTTP client.

Every SDK will install from Abrova Center. Apps use only your public project key (ab_live_…); the server secret (ab_srv_…) stays on your server. 5,000 messages a month are free; the price above that is set when Abrova Chat launches.

Using an AI assistant? See AI assistants for what works today.

Install#

Add the AbrovaChat SDK to your project.

Flutter

AbrovaChat offers two packages: abrova_chat (core, headless, no UI dependencies) and abrova_chat_ui (optional pre-built widgets, includes core). Add one to pubspec.yaml from Abrova Center, then run flutter pub get:

yaml
dependencies:
  abrova_chat:                 # headless/custom UI (recommended)
    hosted: https://center.abrova.ir/api/packages/abrova/pub
    version: ^0.1.5
  # abrova_chat_ui:            # pre-built widgets
  #   hosted: https://center.abrova.ir/api/packages/abrova/pub
  #   version: ^0.1.0

iOS

AbrovaChat offers two libraries: AbrovaChat (headless) and AbrovaChatUI (optional SwiftUI components). Install with Swift Package Manager:

  1. In Xcode: File → Add Package Dependencies → enter https://github.com/Abrova-co/abrova-chat-ios-sdk.git.
  2. Choose version 0.1.4 or later and add the AbrovaChat library (and AbrovaChatUI if you want the components) to your target.
swift
// Or in Package.swift:
dependencies: [
    .package(url: "https://github.com/Abrova-co/abrova-chat-ios-sdk.git", from: "0.1.4")
]

// Then add the product to your target:
.product(name: "AbrovaChat", package: "abrova-chat-ios-sdk")

Android

AbrovaChat offers two packages: abrova-chat-android (headless) and abrova-chat-android-ui (optional Jetpack Compose components).

  1. Add the Abrova Center repository to settings.gradle.kts:
kotlin
dependencyResolutionManagement {
    repositories {
        google()
        mavenCentral()
        maven { url = uri("https://center.abrova.ir/api/packages/abrova/maven") }
    }
}
  1. Add the dependency to build.gradle.kts (app level):
kotlin
dependencies {
    // For headless SDK:
    implementation("ir.abrova:abrova-chat-android:0.1.4")

    // For pre-built Compose components:
    // implementation("ir.abrova:abrova-chat-android-ui:0.1.0")
}

React Native

AbrovaChat offers two packages: @abrova/react-native-chat (headless) and @abrova/react-native-chat-ui (optional pre-built components, includes core).

  1. Point the @abrova scope at Abrova Center in your project's .npmrc:
# .npmrc (in your project root)
@abrova:registry=https://center.abrova.ir/api/packages/abrova/npm/
  1. Install one of them:
bash
# For headless/custom UI:
npm install @abrova/react-native-chat

# For pre-built UI components (includes core):
npm install @abrova/react-native-chat-ui

Web

AbrovaChat offers @abrova/web-chat (headless). Pre-built React components (@abrova/web-chat-ui) will follow later.

  1. Use the same .npmrc line as above:
@abrova:registry=https://center.abrova.ir/api/packages/abrova/npm/
  1. Install the package:
bash
npm install @abrova/web-chat

Node.js (Server)

The server-side SDK for Node.js backends has zero runtime dependencies (it uses native Node.js http/https) and includes TypeScript declarations.

  1. Use the same .npmrc line as above:
@abrova:registry=https://center.abrova.ir/api/packages/abrova/npm/
  1. Install the package:
bash
npm install @abrova/chat
Server-Side Only.

The Node.js SDK and REST API must only be used from your backend server, never from client apps. The server secret can be extracted from client apps.

REST API

bash
# No SDK needed — use any HTTP client
# Base URL: https://chat.abrova.ir

# All requests require (one project key for every Abrova service):
X-API-Key: ab_live_your_api_key
X-Server-Secret: ab_srv_your_server_secret   # from an environment variable, server only
Content-Type: application/json

Initialize#

Create an AbrovaChatClient instance with your API key and connect to start receiving realtime events.

Flutter

dart
import 'package:abrova_chat/abrova_chat.dart';

// Create client configuration
final config = AbrovaChatConfig(
  apiKey: 'ab_live_your_api_key',
  userId: currentUser.id,
  userInfo: {'displayName': currentUser.name},
);

// Initialize the client
final client = AbrovaChatClient(config);

// Connect to realtime (WebSocket)
await client.connect();

// Listen to events
client.onMessage.listen((message) {
  print('New message: ${message.content}');
});

client.onConnectionStateChange.listen((state) {
  print('Connection: $state');
});

// Get unread summary
final unread = await client.getUnreadSummary();
print('Total unread: ${unread.totalUnread}');

// Dispose on logout
client.dispose();

iOS

swift
import AbrovaChat
import Combine

// Create configuration
let config = AbrovaChatConfig(
    apiKey: "ab_live_your_api_key",
    userId: currentUser.id,
    userInfo: ["displayName": currentUser.name]
)

// Initialize client
let client = AbrovaChatClient(config: config)
var cancellables = Set<AnyCancellable>()

// Connect to realtime (WebSocket)
try await client.connect()

// Listen to events using Combine
client.onMessage
    .sink { message in
        print("New message: \(message.content)")
    }
    .store(in: &cancellables)

client.onTypingEvent
    .sink { event in
        print("\(event.userId) is \(event.isTyping ? "typing" : "not typing")")
    }
    .store(in: &cancellables)

client.onPresenceChange
    .sink { event in
        print("\(event.userId) is \(event.isOnline ? "online" : "offline")")
    }
    .store(in: &cancellables)

// Dispose on logout
client.dispose()

Android

kotlin
import ir.abrova.chat.AbrovaChatClient
import ir.abrova.chat.AbrovaChatConfig

// Create configuration
val config = AbrovaChatConfig(
    apiKey = "ab_live_your_api_key",
    userId = currentUser.id,
    userInfo = mapOf("displayName" to currentUser.name)
)

// Initialize client
val client = AbrovaChatClient(config)

// Connect to realtime (WebSocket)
client.connect()

// Listen to events using Kotlin Flow
lifecycleScope.launch {
    client.onMessage.collect { message ->
        println("New message: ${message.content}")
    }
}

lifecycleScope.launch {
    client.onTypingEvent.collect { event ->
        println("${event.userId} is ${if (event.isTyping) "typing" else "not typing"}")
    }
}

lifecycleScope.launch {
    client.onPresenceChange.collect { event ->
        println("${event.userId} is ${if (event.isOnline) "online" else "offline"}")
    }
}

// Dispose on logout
client.dispose()

React Native

typescript
import { AbrovaChatClient } from '@abrova/react-native-chat';

// Create client
const client = new AbrovaChatClient({
  apiKey: 'ab_live_your_api_key',
  userId: currentUser.id,
  userInfo: { displayName: currentUser.name },
});

// Connect to realtime (WebSocket)
client.connect();

// Listen to events
client.on('message', (event) => {
  console.log('New message:', event.message.content);
});

client.on('typing', (event) => {
  console.log(`${event.userId} is ${event.isTyping ? 'typing' : 'not typing'}`);
});

client.on('presence', (event) => {
  console.log(`${event.userId} is ${event.isOnline ? 'online' : 'offline'}`);
});

// Dispose on logout
client.dispose();

Web

typescript
import { AbrovaChatClient } from '@abrova/web-chat';

// Create client
const client = new AbrovaChatClient({
  apiKey: 'ab_live_your_api_key',
  userId: currentUser.id,
  userInfo: { displayName: currentUser.name },
});

// Connect to realtime (WebSocket)
client.connect();

// Listen to events
client.on('message', (event) => {
  console.log('New message:', event.message.content);
});

client.on('typing', (event) => {
  console.log(`${event.userId} is ${event.isTyping ? 'typing' : 'not typing'}`);
});

client.on('presence', (event) => {
  console.log(`${event.userId} is ${event.isOnline ? 'online' : 'offline'}`);
});

// Dispose on logout
client.dispose();

Node.js

typescript
import { AbrovaChat } from '@abrova/chat';

// Initialize with your API key and server secret
const abrovaChat = new AbrovaChat({
  apiKey: process.env.ABROVA_API_KEY,             // ab_live_...
  serverSecret: process.env.ABROVA_SERVER_SECRET, // ab_srv_..., server only
});

// Rooms
const rooms = await abrovaChat.rooms.list('user-123');

// Messages
const { messages, hasMore } = await abrovaChat.messages.getHistory(roomId, {
  userId: 'user-123',
  limit: 50,
});

// Send a message
const msg = await abrovaChat.messages.send(roomId, {
  senderUserId: 'user-123',
  content: 'Hello from the server!',
});

// Reactions, Pins, Webhooks, User tokens
await abrovaChat.reactions.add(msg.id, 'user-456', '👍');
await abrovaChat.pins.pin(msg.id, 'user-123');
const config = await abrovaChat.webhooks.get();
const { token } = await abrovaChat.users.createToken({ userId: 'user-123' });

REST API

bash
# Get your API key (ab_live_...) and server secret (ab_srv_...) from
# Abrova Console (console.abrova.ir): your project > Settings, with Chat enabled

# Test your credentials (lists the rooms of user-123):
curl -X GET "https://chat.abrova.ir/api/v1/rooms?userId=user-123" \
  -H "X-API-Key: ab_live_your_api_key" \
  -H "X-Server-Secret: $ABROVA_SERVER_SECRET"
Tip.

The fileUploader callback lets you use any storage — Abrova Storage, any S3-compatible storage, or your own server. AbrovaChat never stores files; it only stores the URL you return.

این صفحه مفید بود؟
گزارش مشکل