Quick Start

Quick Start

This guide will help you get started with FluxLink by creating your first dynamic link.

Authentication

First, you need to authenticate and get an API key:

  1. Access the web dashboard at http://localhost:3000 (or your custom domain)
  2. Register for an account or log in
  3. Navigate to the API Keys section
  4. Create a new API key and copy it

Using the JavaScript/TypeScript SDK

Installation

Install the FluxLink client SDK in your project:

npm install @fluxlink/client
# or
yarn add @fluxlink/client

Creating Your First Dynamic Link

Here's a simple example of creating a dynamic link using the SDK:

import FluxLink from "@fluxlink/client";
 
// Initialize the client with your API key
const fluxlink = new FluxLink({
  apiKey: "your-api-key",
});
 
// Create a dynamic link
async function createLink() {
  try {
    const link = await fluxlink.createLink({
      title: "Product Page Link",
      defaultUrl: "https://example.com/fallback",
      // Android configuration
      androidLink: {
        url: "myapp://product/123",
        appPackageName: "com.example.myapp",
      },
      // iOS configuration
      iosLink: {
        url: "myapp://product/123",
        bundleId: "com.example.myapp",
      },
    });
 
    console.log("Dynamic Link created:", link);
    // The link.url will contain the shareable dynamic link
    // e.g., https://yourfluxlink.com/abc123
 
    return link;
  } catch (error) {
    console.error("Error creating link:", error);
  }
}
 
createLink();

Retrieving a Link

async function getLink(linkId) {
  try {
    const link = await fluxlink.getLink(linkId);
    console.log("Retrieved link:", link);
    return link;
  } catch (error) {
    console.error("Error retrieving link:", error);
  }
}

Updating a Link

async function updateLink(linkId) {
  try {
    const updatedLink = await fluxlink.updateLink(linkId, {
      title: "Updated Product Link",
      // Update other properties as needed
    });
    console.log("Link updated:", updatedLink);
    return updatedLink;
  } catch (error) {
    console.error("Error updating link:", error);
  }
}

Testing Your Dynamic Link

  1. Create a dynamic link using the SDK or web dashboard
  2. Copy the generated URL
  3. Share the URL on different devices or platforms
  4. Observe how it routes users to different destinations based on their platform

Next Steps

  • Check the SDK Reference for detailed API documentation
  • Explore API Reference for direct REST API usage
  • Implement analytics tracking to measure link performance