# BuiltByBit Automation

### Step 1: Get the Webhook URL

1. Go to the **Integrations** page on SunLicense.
2. Select your product.
3. Copy the **Webhook URL**.
4. The webhook URL should be in the following format:

   ```
   {yourdomain}/api/v1/bbb/{productId}
   ```

### Step 2: Create a Placeholder in BuiltByBit

1. Navigate to the **Placeholders** page in BuiltByBit: [BuiltByBit Placeholders](https://builtbybit.com/resources/dashboard/placeholders)
2. Click on **Create New Placeholder**.
3. Set the placeholder name to something like:

   ```
   %%__MyProduct_License__%%
   ```
4. Set **Type** as `External License Key`.
5. Paste the copied **Webhook URL** in the URL field.
6. Copy the **Secret Key** from the SunLicense **Integrations** page.
7. Paste the secret key in BuiltByBit.
8. Save the placeholder in BuiltByBit.

### Step 3: Use the Placeholder in Your Product

1. When using SunLicense API with your product, assign the placeholder string to the license key variable.
2. Example usage in Java:

   ```java
   String key = "%%__MyProduct_License__%%";

   SunLicenseAPI api = SunLicenseAPI.getLicense(
       key,     // License key
       1,       // Product ID (integer)
       "1.0.0", // Product version
       "http://yourdomain.com/" // API endpoint
   );

   api.validate();
   ```

### Step 4: Automatic License Assignment

* When users download your product, BuiltByBit will automatically create a new license in SunLicense.
* The placeholder `%%__MyProduct_License__%%` will be replaced with the user's actual license key.
* The user's downloaded product will be validated automatically without requiring manual input of the license key.

Now your BuiltByBit product is successfully integrated with SunLicense for seamless license management!
