respond_io_sdk 0.0.1
respond_io_sdk: ^0.0.1 copied to clipboard
Official Respond.io SDK for Flutter - Manage contacts, send messages, and integrate with Respond.io API
Respond.io SDK for Flutter #
A comprehensive Flutter SDK for integrating with the Respond.io API. Manage contacts, send messages, handle conversations, and more.
Features #
- 🔐 Authentication - Secure API token-based authentication
- 👥 Contact Management - Create, update, delete, and search contacts
- 💬 Messaging - Send and retrieve messages
- 🔄 Conversations - Manage conversation lifecycle
- 💭 Comments - Add internal comments to conversations
- 🏢 Workspace - Access workspace-level operations
- ⚡ Rate Limiting - Built-in rate limit handling with automatic retries
- 🛡️ Error Handling - Comprehensive exception handling
- 📦 Type Safety - Immutable models using Freezed
Getting Started #
Installation #
Add this to your package's dependencies:
dependencies:
respond_io_sdk:
path: packages/respond_io_sdk
Authentication #
Get your API access token from your Respond.io workspace:
- Go to Settings → Integrations → Developer API
- Generate a new API Access Token
- Copy the token for use in your app
Usage #
Initialize the SDK #
import 'package:respond_io_sdk/respond_io_sdk.dart';
final respondIO = RespondIO(
RespondIOConfig(
apiToken: 'your_api_token_here',
maxRetries: 3,
timeout: 30000,
),
);
Contact Management #
// Create or update a contact
final contact = await respondIO.contacts.createOrUpdate(
'phone:+1234567890',
ContactFields(
firstName: 'John',
lastName: 'Doe',
email: 'john@example.com',
phone: '+1234567890',
),
);
// Get a contact
final contact = await respondIO.contacts.get('phone:+1234567890');
// Update a contact
await respondIO.contacts.update(
'phone:+1234567890',
ContactFields(firstName: 'Jane'),
);
// Delete a contact
await respondIO.contacts.delete('phone:+1234567890');
Messaging #
// Send a text message
final response = await respondIO.messaging.send(
'phone:+1234567890',
SendMessageRequest(
message: MessageContent(
type: 'text',
text: 'Hello from Flutter!',
),
),
);
// Get message history
final messages = await respondIO.messaging.list(
'phone:+1234567890',
pagination: PaginationParams(limit: 50),
);
Error Handling #
try {
final contact = await respondIO.contacts.get('phone:+1234567890');
} on RespondIOException catch (e) {
print('Error: ${e.message}');
print('Status Code: ${e.statusCode}');
if (e.rateLimitInfo != null) {
print('Rate limit: ${e.rateLimitInfo!.remaining}/${e.rateLimitInfo!.limit}');
print('Retry after: ${e.rateLimitInfo!.retryAfter} seconds');
}
}
Contact Identifiers #
Respond.io supports multiple identifier types:
phone:+1234567890- Phone number (must include country code with +)email:user@example.com- Email addressid:12345- Contact ID
API Reference #
Available Clients #
contacts- Contact management operationsmessaging- Send and retrieve messagesconversations- Conversation managementcomments- Internal commentsspace- Workspace-level operations
For detailed API documentation, see the Respond.io API Documentation.
License #
This package is private and not published to pub.dev.