### Full Grovs Link Creation Example Source: https://docs.grovs.io/docs/sdk/web/link-creation This example demonstrates initializing the Grovs SDK with an API key, starting the service, and creating a link after checking authentication. ```javascript import Grovs from 'grovs'; const grovs = new Grovs('your-api-key', (data) => { console.log('Link data:', data); }); grovs.start(); // Wait for authentication, then create a link if (grovs.authenticated()) { grovs.createLink( 'Share this page', 'Check out what I found', 'https://example.com/og-image.jpg', { page: '/products/12345', source: 'share' }, (response) => console.log('Created:', response), (error) => console.error('Failed:', error) ); } ``` -------------------------------- ### Create environment file Source: https://docs.grovs.io/docs/self-hosting/backend Initialize the .env file from the provided example. ```bash cp .env.example .env ``` -------------------------------- ### Start services Source: https://docs.grovs.io/docs/self-hosting/backend Build and launch the Docker containers. ```bash docker compose up --build ``` -------------------------------- ### start Source: https://docs.grovs.io/docs/sdk/web/api-reference Initializes and authenticates the SDK. Must be called after creating the instance. ```APIDOC ## start ### Description Initialize and authenticate the SDK. Must be called after creating the instance. ### Method GET ### Endpoint grovs.start() ``` -------------------------------- ### Execute Android Setup Script Source: https://docs.grovs.io/docs/sdk/android/revenue Commands to make the setup script executable and run it within the Google Cloud Shell environment. ```bash chmod +x grovs_android_gcloud_setup.sh ./grovs_android_gcloud_setup.sh ``` -------------------------------- ### Example Domains for SDK Registration Source: https://docs.grovs.io/docs/how-to-guides/web/register-domains List of example domains for different environments including production, test, staging, and development. ```text # Production https://www.example.com # Test https://test.example.com # Staging https://staging.example.com # Development http://localhost:8080 http://localhost:3000 ``` -------------------------------- ### Start SDK authentication Source: https://docs.grovs.io/docs/sdk/web/api-reference Initialize and authenticate the SDK. This must be called after the instance is created. ```javascript grovs.start() ``` -------------------------------- ### Install CocoaPods Pod Source: https://docs.grovs.io/docs/how-to-guides/ios/cocoapods Run `pod install` in Terminal to download and integrate the Grovs SDK into your project's workspace. ```bash pod install ``` -------------------------------- ### Start the Dashboard Application Source: https://docs.grovs.io/docs/self-hosting/dashboard Launches the dashboard using either Docker Compose or Node.js. ```bash docker compose up --build ``` ```bash npm install npm run build npm start ``` -------------------------------- ### Install iOS Pods Source: https://docs.grovs.io/docs/how-to-guides/react-native/npm Navigate to the 'ios' directory of your React Native project and run 'pod install' to install CocoaPods dependencies. ```bash cd ios && pod install ``` -------------------------------- ### Fetch Flutter dependencies Source: https://docs.grovs.io/docs/sdk/flutter/quick-start Run this command in your terminal to install the added dependency. ```bash flutter pub get ``` -------------------------------- ### Install Grovs SDK Source: https://docs.grovs.io/docs/how-to-guides/web/npm Downloads the Grovs package and adds it to project dependencies. ```Bash npm install grovs ``` -------------------------------- ### Kamal Production Deployment Steps Source: https://docs.grovs.io/docs/self-hosting/backend Use these commands to set up and deploy your application with Kamal. Ensure you have copied and edited the `deploy.yml` configuration file before running setup and deploy commands. ```bash cp config/deploy.yml.example config/deploy.yml # Edit config/deploy.yml with your server details bundle exec kamal setup bundle exec kamal deploy ``` -------------------------------- ### Install Grovs via CocoaPods Source: https://docs.grovs.io/docs/sdk/ios/quick-start Add the Grovs dependency to your Podfile and install it. ```ruby pod 'Grovs' ``` ```bash pod install ``` -------------------------------- ### Install Grovs SDK via CLI Source: https://docs.grovs.io/docs/how-to-guides/flutter/pub-dev Use the Flutter CLI to automatically add the dependency to your project. ```Bash flutter pub add grovs_flutter_plugin:^1.0.1 ``` -------------------------------- ### Install Grovs NPM Package Source: https://docs.grovs.io/docs/how-to-guides/react-native/npm Use npm to install the Grovs wrapper package. This command adds the package to your project's dependencies. ```bash npm install react-native-grovs-wrapper ``` -------------------------------- ### CustomLinkRedirect Struct Source: https://docs.grovs.io/docs/sdk/ios/api-reference A platform-specific redirect. When `openAppIfInstalled` is `true`, the app opens if installed; otherwise the `link` URL is always used. ```APIDOC ## CustomLinkRedirect Struct ### Description A platform-specific redirect. When `openAppIfInstalled` is `true`, the app opens if installed; otherwise the `link` URL is always used. ### Fields - **link** (String) - The URL to redirect to. - **openAppIfInstalled** (Bool) - If true, the app will open if installed; otherwise, the `link` URL is always used. Defaults to `true`. ``` -------------------------------- ### Get link details Source: https://docs.grovs.io/docs/sdk/ios/api-reference Retrieve metadata for a specific link path. ```Swift Grovs.linkDetails(path: String, completion: @escaping GrovsLinkClosure) ``` -------------------------------- ### Install Grovs Flutter SDK dependency Source: https://docs.grovs.io/docs/sdk/flutter/quick-start Add the plugin to your pubspec.yaml file. ```yaml dependencies: grovs_flutter_plugin: ^1.0.1 ``` -------------------------------- ### Configure Nginx Reverse Proxy Source: https://docs.grovs.io/docs/self-hosting/dashboard Example configuration for serving the dashboard behind an Nginx reverse proxy. ```nginx # nginx example server { server_name app.yourdomain.com; location / { proxy_pass http://localhost:3036; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } } ``` -------------------------------- ### Install Grovs SDK via Yarn Source: https://docs.grovs.io/docs/how-to-guides/react-native/yarn Adds the Grovs wrapper package to the project dependencies. ```bash yarn add react-native-grovs-wrapper ``` -------------------------------- ### Generate Link with cURL Source: https://docs.grovs.io/docs/api-reference Example of generating a new link using a cURL command. Ensure to replace YOUR_PROJECT_KEY with your actual SDK project key. ```bash curl -X POST https://sdk.sqd.link/api/v1/sdk/generate_link \ -H "PROJECT-KEY: YOUR_PROJECT_KEY" \ -H "ENVIRONMENT: production" \ -H "Content-Type: application/json" \ -d '{"title": "My First Link", "data": "{\"screen\": \"home\"}"}' ``` -------------------------------- ### Check authentication status Source: https://docs.grovs.io/docs/sdk/web/api-reference Verify if the SDK is authenticated. Returns true only after a successful start() call. ```javascript grovs.authenticated(): boolean ``` -------------------------------- ### Install Grovs React Native SDK Source: https://docs.grovs.io/docs/sdk/react-native/quick-start Use npm or yarn to add the wrapper package to your React Native project. ```bash # Using npm npm install react-native-grovs-wrapper # Using yarn yarn add react-native-grovs-wrapper ``` -------------------------------- ### Define CustomLinkRedirect Source: https://docs.grovs.io/docs/sdk/ios/api-reference Represents a platform-specific redirect. If openAppIfInstalled is true, the app opens if installed; otherwise, the link URL is used. ```Swift public struct CustomLinkRedirect { public let link: String public var openAppIfInstalled: Bool // default: true } ``` -------------------------------- ### Generate Link with Coroutines - Kotlin Source: https://docs.grovs.io/docs/sdk/android/link-creation This example demonstrates generating a smart link asynchronously using Kotlin coroutines. It includes error handling for `GrovsException`. ```kotlin lifecycleScope.launch { try { val link = Grovs.generateLink( title = "Check out this product", subtitle = "Limited time offer", imageURL = "https://example.com/image.jpg", data = mapOf("productId" to "12345"), tags = listOf("promotion"), tracking = TrackingParams( utmCampaign = "spring_sale", utmSource = "in_app", utmMedium = "share_button" ) ) Log.d("Grovs", "Generated: $link") } catch (e: GrovsException) { Log.e("Grovs", "Error: ${e.message}") } } ``` -------------------------------- ### Open Workspace File Source: https://docs.grovs.io/docs/how-to-guides/ios/cocoapods Always open the `.xcworkspace` file in Xcode after installing pods. Do not use the `.xcodeproj` file, as it will result in missing dependencies. ```bash open YourProject.xcworkspace ``` -------------------------------- ### Share Generated Link using UIActivityViewController Source: https://docs.grovs.io/docs/sdk/ios/link-creation A common pattern is to generate a link and then present a share sheet. This example generates a link and presents a `UIActivityViewController` with the URL. ```swift Grovs.generateLink( title: "Share this", data: ["itemId": "abc"] ) { url in guard let url = url else { return } let activityVC = UIActivityViewController(activityItems: [url], applicationActivities: nil) self.present(activityVC, animated: true) } ``` -------------------------------- ### Generate Link Request Example Source: https://docs.grovs.io/docs/api-reference/generate-link Use this cURL command to send a POST request to the Grovs API to generate a new link. Ensure you replace 'testpr_...' with your actual PROJECT-KEY and set the ENVIRONMENT correctly. ```bash curl -X POST https://sdk.sqd.link/api/v1/sdk/generate_link \ -H "PROJECT-KEY: testpr_86a440d502ee6805ea4f0fabf4dc12afxxxxxxxx" \ -H "ENVIRONMENT: production" \ -H "Content-Type: application/json" \ -d '{ "title": "Summer Sale", "subtitle": "50% off all items", "data": "{\"screen\": \"promo\", \"promo_id\": \"123\"}", "tags": "[\"campaign\", \"summer\"]", "ios_custom_redirect": { "url": "https://example.com/ios", "open_app_if_installed": true }, "android_custom_redirect": { "url": "https://example.com/android", "open_app_if_installed": true }, "desktop_custom_redirect": { "url": "https://example.com/desktop" }, "show_preview_ios": true, "show_preview_android": false, "tracking_campaign": "summer_2025", "tracking_source": "instagram", "tracking_medium": "social" }' ``` -------------------------------- ### Initialize Project with NPM Source: https://docs.grovs.io/docs/how-to-guides/web/npm Creates a package.json file for new projects. ```Bash npm init -y ``` -------------------------------- ### Configure SDK Source: https://docs.grovs.io/docs/sdk/ios/api-reference Initialize the SDK with your API key and environment settings. ```Swift Grovs.configure(APIKey: String, useTestEnvironment: Bool, baseURL: String? = nil, delegate: GrovsDelegate?, completion: GrovsBoolCompletion? = nil) ``` -------------------------------- ### Initialize SDK with configure method Source: https://docs.grovs.io/docs/sdk/android/api-reference Initialize the SDK with your API key; call this in Application.onCreate(). ```Kotlin fun configure(application: Application, apiKey: String, useTestEnvironment: Boolean = false) ``` -------------------------------- ### Initialize CocoaPods Source: https://docs.grovs.io/docs/how-to-guides/ios/cocoapods Navigate to your project directory in Terminal and run `pod init` to create a Podfile. ```bash cd /path/to/your/project pod init ``` -------------------------------- ### Initialize database Source: https://docs.grovs.io/docs/self-hosting/backend Create, migrate, and seed the database within the running container. ```bash docker compose exec web bundle exec rails db:create db:migrate db:seed ``` -------------------------------- ### Configure Web SDK Instance Source: https://docs.grovs.io/docs/self-hosting/sdk-configuration Initialize the Web SDK with a custom baseURL in the options object. ```JavaScript import Grovs from 'grovs'; const grovs = new Grovs('your-api-key', (data) => { console.log('Link data:', data); }, { baseURL: 'https://yourdomain.com' }); grovs.start(); ``` -------------------------------- ### Configure Environment Variables Source: https://docs.grovs.io/docs/self-hosting/dashboard Sets up the local environment file and defines required backend connection and OAuth credentials. ```bash cp .env.example .env.local ``` ```bash # Point to your self-hosted backend API NEXT_PUBLIC_API_URL=https://api.yourdomain.com NEXT_PUBLIC_API_PATH=/api/v1 # OAuth credentials from the backend setup NEXT_PUBLIC_CLIENT_ID=your_oauth_client_id CLIENT_SECRET=your_oauth_client_secret ``` -------------------------------- ### Get unread message count Source: https://docs.grovs.io/docs/sdk/android/api-reference Retrieve the count of unread messages using a coroutine. ```Kotlin suspend fun numberOfUnreadMessages(): Int? ``` -------------------------------- ### Initialize iOS SDK Source: https://docs.grovs.io/docs/sdk/react-native/quick-start Configure the SDK in the AppDelegate using your API key and environment settings. ```swift import Grovs override fun application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { Grovs.configure(APIKey: "your-api-key", useTestEnvironment: false, delegate: self) Grovs.setDebug(level: .info) return true } func grovsReceivedPayloadFromDeeplink(link: String?, payload: [String: Any]?, tracking: [String: Any]?) { // Native delegate callback } ``` -------------------------------- ### Initialize Grovs SDK Source: https://docs.grovs.io/docs/sdk/web/quick-start Import the SDK and initialize it with your API key and a callback function to handle detected links. ```javascript import Grovs from 'grovs'; const grovs = new Grovs('your-api-key', (data) => { // Called when a matching link is detected console.log('Link data:', data); }); // Start the SDK grovs.start(); ``` -------------------------------- ### Initialization and Configuration Source: https://docs.grovs.io/docs/sdk/android/api-reference Methods for initializing and configuring the Grovs SDK. ```APIDOC ## Methods ### configure **Description:** Initialize the SDK with your API key. Call this in your `Application.onCreate()`. **Parameters:** - `application` (Application) - The application context. - `apiKey` (String) - Your Grovs API key. - `useTestEnvironment` (Boolean, optional, default: false) - Set to `true` to use the test environment. ### setSDK **Description:** Enable or disable the SDK. **Parameters:** - `enabled` (Boolean) - `true` to enable, `false` to disable. ### setDebug **Description:** Set the debug logging level. **Parameters:** - `level` (LogLevel) - The desired logging level (`INFO` or `ERROR`). ``` -------------------------------- ### Initialize Grovs SDK instance Source: https://docs.grovs.io/docs/sdk/web/api-reference Create a new SDK instance using your API key and a link handling callback. ```javascript new Grovs(APIKey, linkHandlingCallback) ``` -------------------------------- ### Manage pushToken property Source: https://docs.grovs.io/docs/sdk/android/api-reference Get or set the push notification token for receiving dashboard messages. ```Kotlin Grovs.pushToken: String? ``` -------------------------------- ### Constructor Source: https://docs.grovs.io/docs/sdk/web/api-reference Initializes a new instance of the Grovs SDK. ```APIDOC ## Constructor ### Description Create a new SDK instance. ### Parameters #### Path Parameters - **APIKey** (string) - Required - Your Grovs API key - **linkHandlingCallback** (function) - Required - Callback that receives link data for matching links ``` -------------------------------- ### Manage attributes property Source: https://docs.grovs.io/docs/sdk/android/api-reference Get or set user attributes for identification and behavior analysis in the dashboard. ```Kotlin Grovs.attributes: Map? ``` -------------------------------- ### GET /link/:link_path Source: https://docs.grovs.io/docs/api-reference Retrieve the full details of an existing link using its unique path. ```APIDOC ## GET /link/:link_path ### Description Retrieve the full details of an existing link using its unique path. ### Method GET ### Endpoint https://sdk.sqd.link/api/v1/sdk/link/:link_path ### Headers - **PROJECT-KEY** (string) - Required - Your SDK project key. - **ENVIRONMENT** (string) - Required - Target environment (`production` or `development`). ### Path Parameters - **link_path** (string) - Required - The unique path of the link to retrieve. ### Response #### Success Response (200) - **link_id** (string) - The unique identifier for the link. - **link_path** (string) - The unique path of the link. - **title** (string) - The title of the link. - **data** (string) - JSON string representing custom data or platform-specific redirects. - **created_at** (string) - Timestamp when the link was created. - **updated_at** (string) - Timestamp when the link was last updated. #### Response Example ```json { "link_id": "lnk_abc123", "link_path": "my-first-link", "title": "My First Link", "data": "{\"screen\": \"home\"}", "created_at": "2023-10-27T10:00:00Z", "updated_at": "2023-10-27T10:00:00Z" } ``` ``` -------------------------------- ### Initialize Grovs SDK in AppDelegate Source: https://docs.grovs.io/docs/sdk/ios/quick-start Import the module and configure the SDK within the application launch method. ```swift import Grovs func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { Grovs.configure(APIKey: "your-api-key", useTestEnvironment: false, delegate: self) { success in if success { print("Grovs SDK is ready") } } // Optional: point to a self-hosted backend (domain only, the SDK appends the API path) // Grovs.configure(APIKey: "your-api-key", useTestEnvironment: false, baseURL: "https://your-domain.com", delegate: self) // Optional: enable debug logging Grovs.setDebug(level: .info) // Optional: set user identity Grovs.userIdentifier = "user_id_from_your_app" Grovs.userAttributes = ["name": "John Doe", "plan": "premium"] return true } ``` -------------------------------- ### GET /api/v1/sdk/link/:link_path Source: https://docs.grovs.io/docs/api-reference/link-details Fetch the full details of a link using its unique path identifier. ```APIDOC ## GET https://sdk.sqd.link/api/v1/sdk/link/:link_path ### Description Fetch the full details of a link using its unique path identifier. Replace :link_path with the link's unique path. ### Method GET ### Endpoint https://sdk.sqd.link/api/v1/sdk/link/:link_path ### Parameters #### Path Parameters - **link_path** (string) - Required - The unique path segment of the link. #### Headers - **PROJECT-KEY** (string) - Required - Your SDK project key. - **ENVIRONMENT** (string) - Required - Target environment (production or development). - **Content-Type** (string) - Required - Must be application/json. ### Request Example ```bash curl -X GET https://sdk.sqd.link/api/v1/sdk/link/ef5006 \ -H "PROJECT-KEY: testpr_86a440d502ee6805ea4f0fabf4dc12afxxxxxxxx" \ -H "ENVIRONMENT: production" \ -H "Content-Type: application/json" ``` ### Response #### Success Response (200) - **link** (object) - The link details object containing id, title, subtitle, path, access_path, updated_at, generated_from_platform, data, sdk_generated, tags, active, tracking_campaign, tracking_source, tracking_medium, show_preview, image, ios_custom_redirect, android_custom_redirect, and desktop_custom_redirect. #### Response Example { "link": { "id": 50510, "title": "Summer Sale", "subtitle": "50% off all items", "path": "ef5006", "access_path": "https://grov3cf9.sqd.link/ef5006", "updated_at": "2025-05-02T12:43:53.604Z", "generated_from_platform": "API", "data": { "screen": "promo", "promo_id": "123" }, "sdk_generated": true, "tags": ["campaign", "summer"], "active": true, "tracking_campaign": "summer_2025", "tracking_source": "instagram", "tracking_medium": "social", "show_preview": true, "image": null, "ios_custom_redirect": { "url": "https://example.com/ios", "open_app_if_installed": true }, "android_custom_redirect": { "url": "https://example.com/android", "open_app_if_installed": true }, "desktop_custom_redirect": { "url": "https://example.com/desktop", "open_app_if_installed": false } } } ``` -------------------------------- ### Configure domain settings Source: https://docs.grovs.io/docs/self-hosting/backend Set host and protocol variables in the .env file for backend and dashboard connectivity. ```bash # Backend SERVER_HOST_PROTOCOL=https:// SERVER_HOST=yourdomain.com # Dashboard (where the frontend will be hosted) REACT_HOST_PROTOCOL=https:// REACT_HOST=app.yourdomain.com ``` -------------------------------- ### Initialize Grovs SDK in Swift Source: https://docs.grovs.io/docs/migration-guides/firebase-dynamic-links/ios Configure the Grovs SDK in your application's didFinishLaunchingWithOptions method. Provide your API key, set the test environment, and supply a delegate for handling deep links. Debugging can be enabled by setting the log level. ```swift import Grovs func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { Grovs.configure(APIKey: "your-api-key", useTestEnvironment: false, delegate: yourDelegate) Grovs.setDebug(level: .info) return true } ``` -------------------------------- ### Initialize Android SDK Source: https://docs.grovs.io/docs/sdk/react-native/quick-start Configure the SDK within the onCreate method of your MainApplication class. ```kotlin override fun onCreate() { super.onCreate() Grovs.configure(this, "your-api-key") } ``` -------------------------------- ### Manage user attributes Source: https://docs.grovs.io/docs/sdk/ios/api-reference Get or set user attributes used for identification and behavior analysis in the dashboard. ```Swift Grovs.userAttributes: [String: Any]? ``` -------------------------------- ### Generate Release Keystore Fingerprint with keytool Source: https://docs.grovs.io/docs/how-to-guides/android/sha256-fingerprint Execute the `keytool` command in your terminal to list details of your release keystore. Ensure the JDK `bin` directory is in your system's PATH if `keytool` is not found. You will need to provide the paths to your keystore, alias, store password, and key password. ```bash keytool -list -v \ -keystore /path/to/your/release.keystore \ -alias your_alias_name \ -storepass your_keystore_password \ -keypass your_key_password ``` -------------------------------- ### Initialize Branch.io SDK Source: https://docs.grovs.io/docs/migration-guides/branch-io/ios Use this code in your AppDelegate for Branch.io SDK initialization. It handles session initiation and deep link parameters. ```swift Branch.getInstance().initSession(launchOptions: launchOptions) { params, error in // Handle params (deep link data) here } ``` -------------------------------- ### Get Unread Message Count Source: https://docs.grovs.io/docs/sdk/react-native/messages Retrieve the number of unread messages. This is useful for displaying a badge count. ```javascript const count = await Grovs.numberOfUnreadMessages(); console.log(`Unread: ${count}`); ``` -------------------------------- ### Clone the Dashboard Repository Source: https://docs.grovs.io/docs/self-hosting/dashboard Initializes the local dashboard environment by cloning the repository. ```bash git clone https://github.com/grovs-io/dashboard.git cd dashboard ``` -------------------------------- ### Manage identifier property Source: https://docs.grovs.io/docs/sdk/android/api-reference Get or set the user identifier, typically mapped to the app's user_id. ```Kotlin Grovs.identifier: String? ``` -------------------------------- ### Import Grovs Package in Code Source: https://docs.grovs.io/docs/how-to-guides/react-native/npm Import the Grovs SDK into your JavaScript or TypeScript files to start using its functionalities. ```javascript import Grovs from 'react-native-grovs-wrapper'; ``` -------------------------------- ### Clone the repository Source: https://docs.grovs.io/docs/self-hosting/backend Download the backend source code to your local machine. ```bash git clone https://github.com/grovs-io/backend.git cd backend ``` -------------------------------- ### Initialize Grovs SDK Source: https://docs.grovs.io/docs/how-to-guides/web/npm Initializes the SDK instance with the required API key configuration. ```JavaScript // Initialize Grovs with your configuration Grovs.initialize({ apiKey: 'your-api-key', // Additional configuration options }); ``` -------------------------------- ### Manage user identifier Source: https://docs.grovs.io/docs/sdk/ios/api-reference Get or set the user identifier, typically mapped to your app's user_id for dashboard reporting. ```Swift Grovs.userIdentifier: String? ``` -------------------------------- ### Getting Link Details Source: https://docs.grovs.io/docs/sdk/android/deep-linking Retrieve details for a specific link path using either a callback-based approach or a coroutine-based approach. ```APIDOC ## Get Link Details ### Description Retrieve details for a specific link path. ### Method `Grovs.linkDetails` ### Parameters #### Path Parameters - **path** (String) - Required - The path of the link to retrieve details for. #### Callback Listener (Optional) - **lifecycleOwner** (LifecycleOwner) - Required for callback method - The lifecycle owner. - **listener** (Function) - Required for callback method - A callback function that receives details or an error. - **details** (Object) - The details of the link. - **error** (Error) - An error object if retrieval fails. ### Request Example (Callback) ```kotlin Grovs.linkDetails( path = "/my-link-path", lifecycleOwner = this, listener = { details, error -> details?.let { Log.d("Grovs", "Details: $it") } } ) ``` ### Request Example (Coroutines) ```kotlin val details = Grovs.linkDetails(path = "/my-link-path") ``` ### Response (Success) - **details** (Object) - Contains information about the link. ``` -------------------------------- ### Configure iOS SDK with Base URL Source: https://docs.grovs.io/docs/self-hosting/sdk-configuration Initialize the Grovs SDK in the application delegate by providing the custom baseURL. ```Swift import Grovs func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { Grovs.configure( APIKey: "your-api-key", useTestEnvironment: false, baseURL: "https://yourdomain.com", delegate: self ) return true } ``` -------------------------------- ### Set Push Notification Token Source: https://docs.grovs.io/docs/sdk/react-native/messages Pass the FCM token to the SDK to receive push notifications for dashboard messages. Ensure you have `@react-native-firebase/messaging` installed. ```javascript import Grovs from 'react-native-grovs-wrapper'; import messaging from '@react-native-firebase/messaging'; const token = await messaging().getToken(); if (token) { Grovs.setPushToken(token); } ``` -------------------------------- ### Verify deployment Source: https://docs.grovs.io/docs/self-hosting/backend Check the health of the backend service. ```bash curl http://localhost:8765/up ``` -------------------------------- ### Retrieve Latest Referring Params with Branch.io Source: https://docs.grovs.io/docs/migration-guides/branch-io/ios Get the latest referring parameters to understand user attribution. This method is available via Branch.getInstance(). ```swift Branch.getInstance().getLatestReferringParams() ``` -------------------------------- ### Get Unread Message Count Source: https://docs.grovs.io/docs/sdk/ios/messages Retrieve the number of unread messages, which is useful for displaying a badge count. The count is provided in the completion handler. ```swift Grovs.numberOfUnreadMessages { count in print("Unread: \(count)") } ``` -------------------------------- ### Verify SDK Registration with cURL Source: https://docs.grovs.io/docs/how-to-guides/web/register-domains Use cURL commands to test SDK integration and verify registration in different environments. ```bash # Test production curl https://www.example.com/verify-sdk # Test staging curl https://staging.example.com/verify-sdk # Test development curl http://localhost:3000/verify-sdk ``` -------------------------------- ### Configure Android SDK with Base URL Source: https://docs.grovs.io/docs/self-hosting/sdk-configuration Initialize the Grovs SDK in the Application class with the custom baseURL. ```Kotlin class MyApplication : Application() { override fun onCreate() { super.onCreate() Grovs.configure(this, "your-api-key", baseURL = "https://yourdomain.com") } } ``` -------------------------------- ### Get Number of Unread Grovs Messages Source: https://docs.grovs.io/docs/sdk/android/messages Retrieve the count of unread messages using Grovs.numberOfUnreadMessages(). This is useful for displaying a badge or notification indicator. ```Kotlin val count = Grovs.numberOfUnreadMessages() Log.d("Grovs", "Unread: $count") ``` -------------------------------- ### Initialize Grovs SDK Source: https://docs.grovs.io/docs/sdk/flutter/quick-start Basic initialization and user identity configuration in Dart. ```dart import 'package:grovs_flutter_plugin/grovs.dart'; final grovs = Grovs(); // Set debug logging await grovs.setDebugLevel('info'); // Set user identity (optional) await grovs.setUserIdentifier('user-123'); await grovs.setUserAttributes({ 'name': 'Jane Doe', 'email': 'jane@example.com', }); ``` -------------------------------- ### SDK Configuration Methods Source: https://docs.grovs.io/docs/sdk/react-native/api-reference Methods for configuring the SDK state, logging, and user identification. ```APIDOC ## setSDK ### Description Enable or disable the SDK. ### Method void ### Parameters - **enabled** (boolean) - Required - Whether the SDK is enabled. ## setDebug ### Description Set the debug logging level. ### Parameters - **level** (LogLevel) - Required - Options: 'info', 'error'. ## setPushToken ### Description Set the push notification token for receiving dashboard messages. ### Parameters - **pushToken** (string) - Optional - The push notification token. ## setIdentifier ### Description Set the user identifier for the Grovs dashboard. ### Parameters - **identifier** (string) - Optional - The unique user identifier. ## setAttributes ### Description Set user attributes for identification and behavior analysis. ### Parameters - **attributes** (object) - Optional - Key-value pairs of user attributes. ``` -------------------------------- ### Get Number of Unread Grovs Messages Source: https://docs.grovs.io/docs/sdk/react-native/api-reference Retrieve the count of unread messages for the current user. Returns a promise that resolves with the number of unread messages. ```typescript numberOfUnreadMessages(): Promise ``` -------------------------------- ### Configure useTestEnvironment property Source: https://docs.grovs.io/docs/sdk/android/api-reference Set to true to enable the test environment. ```Kotlin Grovs.useTestEnvironment: Boolean ``` -------------------------------- ### Initialize Grovs SDK Source: https://docs.grovs.io/docs/sdk/android/quick-start Initialize the Grovs SDK in your Application class's onCreate method. Requires your API key. ```Kotlin class MyApplication : Application() { override fun onCreate() { super.onCreate() Grovs.configure(this, "your-api-key") } } ``` -------------------------------- ### Retrieve Details for a Specific Deep Link Source: https://docs.grovs.io/docs/sdk/ios/deep-linking Use Grovs.linkDetails to get specific information about a configured deep link path. This function requires the path of the link as a parameter. ```swift Grovs.linkDetails(path: "/my-link-path") { details in print("Link details: \(details)") } ``` -------------------------------- ### Forward activity lifecycle methods Source: https://docs.grovs.io/docs/sdk/android/api-reference Required methods to forward launcher activity events to the SDK. ```Kotlin fun onStart(activity: Activity) ``` ```Kotlin fun onNewIntent(intent: Intent?) ``` -------------------------------- ### Retrieve Last Received Deep Link Payload Source: https://docs.grovs.io/docs/sdk/ios/deep-linking Use Grovs.lastReceivedPayload to get the most recent payload received by the app. This is useful for immediate post-launch deep link handling. ```swift Grovs.lastReceivedPayload { payload in print("Last payload: \(payload)") } ``` -------------------------------- ### Run Flutter application Source: https://docs.grovs.io/docs/how-to-guides/flutter/pub-dev Execute the application on a specific target device. ```Bash flutter run -d ios ``` -------------------------------- ### Handle Scene Connection Options in SceneDelegate (Branch.io) Source: https://docs.grovs.io/docs/migration-guides/branch-io/ios Use this code in your SceneDelegate to handle initial scene connections with Branch.io, processing user activities and URL contexts. ```swift @available(iOS 13.0, *) func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { if let userActivity = connectionOptions.userActivities.first { Branch.getInstance().continue(userActivity) } else if let urlContext = connectionOptions.urlContexts.first { Branch.getInstance().handleDeepLink(urlContext.url) } } ``` -------------------------------- ### Generate encryption keys Source: https://docs.grovs.io/docs/self-hosting/backend Initialize Rails encryption keys and add them to the .env file. ```bash docker compose run --rm web bin/rails db:encryption:init ``` ```bash ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY=generated_key_here ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY=generated_key_here ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT=generated_key_here ``` -------------------------------- ### Enable or disable SDK Source: https://docs.grovs.io/docs/sdk/ios/api-reference Toggle the SDK state. ```Swift Grovs.setSDK(enabled: Bool) ``` -------------------------------- ### Create a smart link Source: https://docs.grovs.io/docs/sdk/web/api-reference Generate a new smart link with preview metadata and custom payload data. ```javascript grovs.createLink(title, subtitle, imageURL, data, success, error) ``` -------------------------------- ### Initialize Grovs SDK in Android Application Source: https://docs.grovs.io/docs/migration-guides/branch-io/android Configure the Grovs SDK in your Application class. Ensure you replace 'your-api-key' with your actual API key and set `useTestEnvironment` appropriately. The debug level can be optionally set. ```kotlin class MainApplication : Application() { override fun onCreate() { super.onCreate() Grovs.configure(application = this, apiKey = "your-api-key", useTestEnvironment = false) Grovs.setDebug(Grovs.DebugLevel.INFO) // Optional } } ``` -------------------------------- ### Create a Smart Link Source: https://docs.grovs.io/docs/sdk/web/link-creation Use `createLink` to generate a smart link with a title, subtitle, image URL, custom data, and callbacks for success and error. ```javascript grovs.createLink( 'Check out this product', 'Limited time offer', 'https://example.com/image.jpg', { productId: '12345', screen: 'product_detail', }, (response) => { console.log('Link created:', response); }, (error) => { console.error('Error:', error); } ); ``` -------------------------------- ### Retrieve All Deep Link Payloads Since Startup Source: https://docs.grovs.io/docs/sdk/ios/deep-linking Fetch all payloads received since the application launched using Grovs.allReceivedPayloadsSinceStartup. This allows for processing multiple deep links that may have occurred. ```swift Grovs.allReceivedPayloadsSinceStartup { payloads in guard let payloads = payloads else { return } for payload in payloads { print("Payload: \(payload)") } } ``` -------------------------------- ### Configure AndroidManifest.xml for Grovs Source: https://docs.grovs.io/docs/sdk/flutter/quick-start Add API key and environment settings within the application tag. ```xml ``` -------------------------------- ### Enable Grovs SDK Debug Logging (Swift) Source: https://docs.grovs.io/docs/self-hosting/sdk-configuration Enable debug logging to verify the SDK connects to your backend. Check console output for communication with sdk.yourdomain.com. ```swift Grovs.setDebug(level: .info) ``` -------------------------------- ### Generating a Link Source: https://docs.grovs.io/docs/sdk/react-native/link-creation This snippet demonstrates how to use the `Grovs.generateLink` function to create a smart link with all available parameters. ```APIDOC ## POST /api/links (Conceptual) ### Description Generates a smart link programmatically with customizable options. ### Method POST (Conceptual - This is a client-side SDK function, not a direct API endpoint) ### Endpoint N/A (Client-side SDK) ### Parameters #### Request Body (Conceptual - Parameters passed to the SDK function) - **title** (string?) - Link preview title - **subtitle** (string?) - Link preview subtitle - **imageURL** (string?) - Link preview image URL - **data** (object?) - Custom payload delivered on deep link open - **tags** (string[]?) - Tags for filtering and analytics - **customRedirects** (object?) - Override default redirect behavior per platform. Structure: - **android** (object) - Android specific redirects - **link** (string) - The URL to redirect to on Android - **open_if_app_installed** (boolean) - Whether to open the app if installed - **ios** (object) - iOS specific redirects - **link** (string) - The URL to redirect to on iOS - **open_if_app_installed** (boolean) - Whether to open the app if installed - **desktop** (object) - Desktop specific redirects - **link** (string) - The URL to redirect to on Desktop - **open_if_app_installed** (boolean) - Whether to open the app if installed - **showPreviewIos** (boolean?) - Show link preview on iOS - **showPreviewAndroid** (boolean?) - Show link preview on Android - **tracking** (object?) - UTM tracking parameters. Structure: - **utm_medium** (string) - UTM medium - **utm_source** (string) - UTM source - **utm_campaign** (string) - UTM campaign ### Request Example ```javascript { title: "Check out this product", subtitle: "Limited time offer", imageURL: "https://example.com/image.jpg", data: { productId: "12345", screen: "product_detail", }, tags: ["promotion", "share"], customRedirects: { android: { link: "https://example.com/android", open_if_app_installed: true, }, ios: { link: "https://example.com/ios", open_if_app_installed: false, }, desktop: { link: "https://example.com/desktop", open_if_app_installed: true, }, }, showPreviewIos: false, showPreviewAndroid: false, tracking: { utm_medium: "share_button", utm_source: "in_app", utm_campaign: "spring_sale", } } ``` ### Response #### Success Response (200) - **link** (string) - The generated smart link URL #### Response Example ```json { "link": "https://grovs.io/generated/xyz123" } ``` ``` -------------------------------- ### Configure iOS Info.plist Source: https://docs.grovs.io/docs/sdk/flutter/quick-start Add the Grovs API key and test environment flag to your Info.plist file. ```xml GrovsApiKey YOUR_API_KEY GrovsUseTestEnvironment ``` -------------------------------- ### Handle AppDelegate events Source: https://docs.grovs.io/docs/sdk/ios/api-reference Forward universal link continuations or URL opening events from your AppDelegate. ```Swift Grovs.handleAppDelegate(continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool ``` ```Swift Grovs.handleAppDelegate(open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool ``` -------------------------------- ### Grovs SDK Configuration Source: https://docs.grovs.io/docs/sdk/ios/api-reference Methods for initializing and managing the state of the Grovs SDK. ```APIDOC ## Grovs.configure ### Description Initialize the SDK with your API key and environment settings. ### Parameters - **APIKey** (String) - Required - Your project API key from the Grovs dashboard. - **useTestEnvironment** (Bool) - Required - When true, the SDK operates in test mode. - **baseURL** (String?) - Optional - Optional domain for self-hosted backends. - **delegate** (GrovsDelegate?) - Optional - The delegate that receives deep link callbacks. - **completion** (GrovsBoolCompletion?) - Optional - Callback indicating whether SDK authentication succeeded or failed. ## Grovs.setSDK ### Description Enable or disable the SDK. ### Parameters - **enabled** (Bool) - Required - Boolean to enable or disable the SDK. ``` -------------------------------- ### Configure React Native Android MainApplication Source: https://docs.grovs.io/docs/self-hosting/sdk-configuration Pass the base URL during SDK configuration in the MainApplication class. ```Kotlin override fun onCreate() { super.onCreate() Grovs.configure(this, "your-api-key", baseURL = "https://yourdomain.com") } ``` -------------------------------- ### Initialize Branch.io SDK in Android Application Source: https://docs.grovs.io/docs/migration-guides/branch-io/android The Branch.io SDK is typically initialized in the `onCreate()` method of your `Application` class using `Branch.getAutoInstance(this)`. ```kotlin class MainApplication : Application() { override fun onCreate() { super.onCreate() Branch.getAutoInstance(this) } } ``` -------------------------------- ### Enable or disable SDK with setSDK Source: https://docs.grovs.io/docs/sdk/android/api-reference Toggle the SDK enabled state. ```Kotlin fun setSDK(enabled: Boolean) ``` -------------------------------- ### createLink Source: https://docs.grovs.io/docs/sdk/web/api-reference Creates a new smart link with provided details. ```APIDOC ## createLink ### Description Create a new smart link. ### Method POST ### Endpoint grovs.createLink(title, subtitle, imageURL, data, success, error) ### Parameters #### Path Parameters - **title** (string) - Required - Link preview title - **subtitle** (string) - Required - Link preview subtitle - **imageURL** (string) - Required - Link preview image URL - **data** (object) - Optional - Custom payload data - **success** (function) - Required - Success callback with link response - **error** (function) - Required - Error callback ``` -------------------------------- ### Handle Android Incoming Links Source: https://docs.grovs.io/docs/sdk/react-native/quick-start Implement lifecycle methods in your MainActivity to process incoming deep links. ```kotlin override fun onStart() { super.onStart() Grovs.onStart(this) } override fun onNewIntent(intent: Intent?) { super.onNewIntent(intent) Grovs.onNewIntent(intent, this) } ``` -------------------------------- ### Configure Flutter iOS Info.plist Source: https://docs.grovs.io/docs/self-hosting/sdk-configuration Add the base URL and API key to the Info.plist file for iOS. ```XML GrovsApiKey YOUR_API_KEY GrovsUseTestEnvironment GrovsBaseURL https://yourdomain.com ``` -------------------------------- ### Generate Short Links with Branch.io Source: https://docs.grovs.io/docs/migration-guides/branch-io/android Use `BranchUniversalObject` to define link properties like canonical identifier, title, description, and image URL. Then, call `generateShortUrl` to create the link. ```kotlin val buo = BranchUniversalObject() .setCanonicalIdentifier("item/12345") .setTitle("Welcome to My App!") .setContentDescription("Some social description.") .setContentImageUrl("https://example.com/image.jpg") buo.generateShortUrl(this) { url, error -> if (error == null) { // Link created } else { // Error } } ``` -------------------------------- ### Log a Custom Purchase Source: https://docs.grovs.io/docs/sdk/android/revenue Use this function to log a purchase processed through your own server or a non-Play Store payment system. Ensure all required parameters are provided. ```kotlin Grovs.logCustomPurchase( type = PaymentEventType.BUY, priceInCents = 999, // $9.99 currency = "USD", productId = "premium_monthly" ) ``` -------------------------------- ### Configure Grovs SDK in AppDelegate Source: https://docs.grovs.io/docs/migration-guides/branch-io/ios Configure the Grovs SDK in your AppDelegate. Ensure you replace 'your-api-key' and 'yourDelegate' with your actual values. Debug level can also be set here. ```swift import Grovs func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { Grovs.configure(APIKey: "your-api-key", useTestEnvironment: false, delegate: yourDelegate) // Optionally, set debug level and user attributes Grovs.setDebug(level: .info) return true } ``` -------------------------------- ### Verify pubspec.yaml configuration Source: https://docs.grovs.io/docs/how-to-guides/flutter/pub-dev Ensure the plugin is correctly listed under the dependencies section of your configuration file. ```YAML dependencies: flutter: sdk: flutter grovs_flutter_plugin: ^1.0.1 ```