Skip to content

Latest commit

 

History

History
147 lines (100 loc) · 5.02 KB

File metadata and controls

147 lines (100 loc) · 5.02 KB

Contributing to Crisp Chat Flutter Package

Thanks for your interest in contributing to the Crisp Chat Flutter Package! Your contributions help improve the experience for everyone using this package. Please take a moment to review this guide before getting started.


🚀 Getting Started

To run and work on this project locally, follow these steps:

1. Fork the Repository

  • Click the Fork button in the top-right corner of the repository page.
  • Clone your forked repository to your local machine:
git clone https://github.com/alamin-karno/flutter-crisp-chat
cd flutter_crisp_chat

2. Set Up the Example App

The example folder contains a Flutter project to test the Crisp Chat plugin.

You’ll need to add some secrets and configurations to run it properly:

3. Add Firebase Support

To run this project, you need to add your Firebase configuration files:

  • android/app/google-services.json
  • ios/Runner/GoogleService-Info.plist

These files are not included in this repo for security reasons.

  • Create a new Firebase project at Firebase Console.

  • Add an iOS app and an Android app (optional) and get the Firebase auto setup. If not then follow below steps.

  • Download the GoogleService-Info.plist file for iOS and place it in:

example/ios/Runner/GoogleService-Info.plist
  • Download the google-services.json file for Android and place it in:
example/android/app/google-services.json

You may also need to enable Firebase Cloud Messaging if you want to test push notifications.

4. Add Crisp Website ID

  • First, you need to create a Crisp account and set up a website.

  • You can get your Website ID from your Crisp Dashboard.

  • Then, create a config.json file in the example/lib/ directory to store your Crisp Website ID.

  • In the example/lib/config.json provide your Crisp Website ID:

    {
        "websiteId": "PUT_YOUR_WEBSITE_ID_HERE",
        "identifier": "YOUR_CRISP_API_IDENTIFIER",
        "crispApiKey": "YOUR_CRISP_API_KEY"
    }
  • For every request that you make to getUnreadMessageCount, you must submit your authentication token (identifier and key), as well as your website_id.

    • Obtaining Identifier & Key:

      1. Head over to the Crisp Marketplace
      2. Sign in or create an account (this account is different from your main Crisp account)
      3. Once logged-in, go to Plugins and click on the New Plugin button
      4. Select the plugin type, in this case Private
      5. Name your plugin a name, eg. "My First Crisp Plugin", and hit Create
      6. On the plugin tab, go to Tokens and scroll down to Development Token to view (and manage) your token identifier/key pair
      7. Obtaining a production token is the next natural step once you are ready to step into production with your plugin or if your usage requires higher quotas.
    • Before using your development token, you now need to associate your marketplace account to your Crisp workspace. This is done by specifying a Trusted Workspace:

      1. Go to the Settings of your Crisp Marketplace account
      2. Click on Add Trusted Workspace and submit your website_id
      3. Enter the credentials of your main Crisp account (the ones you use to access your main Crisp account) and then submit your 2FA token (if any is enabled)
      4. You're all done! You are now ready to use REST API and start building your plugin
  • Then, run your project:

    flutter run --dart-define-from-file=config.json

or, you can add --dart-define-from-file=config.json on Android Studio or VSCode run configurations.


🔧 Contributing Code

Step-by-step process:

  1. Open an Issue

    • Describe what you want to fix or add.
    • Explain your motivation or expected outcome.
  2. Create a Feature Branch

    • Always base your changes on a specific issue.
    • Use a clear naming convention:
    git checkout -b fix/issue-23-fix-push-notification
  3. Make Your Changes

    • Follow the coding style already present in the plugin.
    • Keep commits atomic and descriptive.
    • If you’re changing native code, test it in the example app.
  4. Push & Open a Pull Request (PR)

    • Push your branch:
    git push origin fix/issue-23-fix-push-notification
    • Open a pull request on GitHub, referencing the issue number in the description.

✅ Code Style & Best Practices

  • Use meaningful commit messages. Example:
fix(iOS): handle missing deviceToken crash on launch
  • Always test your code using the example project.
  • If your change includes a fix or feature, update the README.md if needed.

💬 Need Help?

If you’re unsure about something, feel free to:

  • Create a GitHub Discussion or Issue
  • Message the maintainer for clarification We’re happy to help you get started!

Thank you for contributing! 🙌