@armiachat/chatsdk
v1.0.2
Published
Chat SDK for React Native
Readme
Chat SDK
A powerful and easy-to-use Chat SDK built with React Native and Supabase. This SDK allows developers to integrate real-time chat functionality into their mobile applications with minimal setup.
Getting Started
Note: Make sure you have completed the Set Up Your Environment guide before proceeding.
Installation
To install the SDK in your React Native project, run:
# Using npm
npm install @your-username/chat-sdk
# OR using Yarn
yarn add @your-username/chat-sdkStep 1: Initialize the Chat SDK
Import and initialize the SDK in your project:
import ChatSDK from '@your-username/chat-sdk';
ChatSDK.initialize({
supabaseUrl: 'https://your-supabase-url.supabase.co',
supabaseAnonKey: 'your-anon-key',
});Step 2: Usage
Sending a Message
ChatSDK.sendMessage({
groupId: 'group-id',
userId: 'user-id',
message: 'Hello, world!'
});Fetching Messages
const messages = await ChatSDK.getMessages('group-id');
console.log(messages);Handling Notifications
ChatSDK.enablePushNotifications();Step 3: Modify and Extend
Now that you have successfully integrated the Chat SDK, you can extend its functionalities:
- Customize UI using
React Native Gifted Chat - Add media sharing like images and audio
- Implement group chat enhancements
Configuration
Ensure your Supabase project has the following tables:
usersgroupsgroup_membersgroup_messages
Troubleshooting
If you're having issues getting the above steps to work, see the Troubleshooting page.
Development & Contribution
- Clone the repository:
git clone https://github.com/your-username/chat-sdk.git cd chat-sdk - Install dependencies:
yarn install - Build the SDK:
yarn build - Run tests:
yarn test
Publishing to NPM
To publish a new version:
yarn build
npm publish --access publicLicense
MIT License
