A flexible, provider-agnostic SDK for RCS (Rich Communication Services) messaging, designed with a modular architecture that currently supports Longears RCS provider with the ability to extend to other providers in the future.
The @longears-mobile/rcs-sdk
provides a unified interface for sending RCS messages, handling authentication, and managing capabilities detection. It's designed to be extensible, type-safe, and easy to integrate.
- 🔌 Provider-Agnostic Design: Built with a modular architecture to support multiple providers
- 🚀 Longears Provider: Ships with full support for the Longears RCS API
- 🔐 Secure Authentication: HMAC-based authentication for Longears provider
- 📱 Rich Messaging: Send text, media, rich cards, and interactive elements
- 🔄 Automatic Retries: Built-in retry logic with exponential backoff
- 📊 Capability Detection: Check device and carrier RCS support
- 🛠️ TypeScript Support: Fully typed interfaces for better developer experience
The SDK follows an adapter pattern with the following key components:
- RCSClient: Main entry point for SDK usage
- Providers: Adapter implementations for RCS services (currently Longears)
- Authentication: Authentication provider for Longears
- Interfaces: Unified message and capability interfaces
import { RCSClient } from '@longears-mobile/rcs-sdk';
// Initialize with Longears provider
const client = new RCSClient({
provider: 'longears',
auth: {
type: 'longears',
credentials: {
apiKey: process.env.LONGEARS_API_KEY,
apiSecret: process.env.LONGEARS_API_SECRET
}
}
});
await client.initialize();
// Send a message
const response = await client.sendMessage({
to: '+1234567890',
content: {
text: 'Hello from Longears RCS!'
},
suggestions: [
{ type: 'reply', text: 'Yes' },
{ type: 'reply', text: 'No' }
]
});
- Longears: Full support for Longears RCS API
The SDK is designed to be provider-agnostic with Longears as the starting point. The modular architecture makes it easy to add support for other providers in the future.
npm install @longears-mobile/rcs-sdk
The SDK is available in multiple formats:
- ES Modules -
import { RCSClient } from '@longears-mobile/rcs-sdk';
(primary format) - CommonJS -
const { RCSClient } = require('@longears-mobile/rcs-sdk');
(compatibility) - UMD - Available via CDN or direct script tag:
<script src="https://unpkg.com/@longears-mobile/rcs-sdk"></script>
- Node.js: v24.0.0 or higher
See the docs/
directory for:
The SDK is designed to be easily extended with new RCS providers:
- Create a new provider class that implements the
RCSProvider
interface - Create a corresponding authentication provider that implements the
AuthProvider
interface - Update the provider and authentication factories to include your new implementations
- Update configuration interfaces as needed
Contributions are welcome! Feel free to submit issues or pull requests.
MIT