Skip to main content
Integrate Mellowtel into your Windows desktop application to allow users to share their unused internet bandwidth in exchange for rewards or premium features. It’s privacy-focused, transparent, and fully compliant with user consent requirements.
User consent is mandatory. The SDK will throw an InvalidOperationException if you call StartAsync() without the user having opted in. You cannot bypass this check.

Prerequisites

  • A Mellowtel account and configuration key (get yours from the dashboard)
  • A NuGet access token provided by Mellowtel
  • .NET desktop application (Console, WPF, or Windows Forms)

Installation

1. Configure NuGet Authentication

Create a file named nuget.config in your project’s root directory (the same folder as your .csproj or .sln file):
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <clear />
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
    <add key="github-mellowtel" value="https://nuget.pkg.github.com/olostep/index.json" />
  </packageSources>
  <packageSourceCredentials>
    <github-mellowtel>
      <add key="Username" value="mellowtel-packages" />
      <add key="ClearTextPassword" value="YOUR_PROVIDED_TOKEN" />
    </github-mellowtel>
  </packageSourceCredentials>
</configuration>
Replace YOUR_PROVIDED_TOKEN with the token you received from Mellowtel.

2. Install the Package

Open your terminal in the project directory and run:
dotnet add package Mellowtel.Windows
Then restore packages:
dotnet restore

3. Add to Your Code

using MellowtelWin;

// Initialize Mellowtel with your configuration key
var mellowtel = new Mellowtel("YOUR_CONFIGURATION_KEY");

// Check if user has already opted in
if (!mellowtel.GetOptInStatus())
{
    // Show your consent dialog — ONLY call OptIn() if the user agrees
    mellowtel.OptIn();
}

// Start the service (throws InvalidOperationException if not opted in)
try
{
    await mellowtel.StartAsync();
}
catch (InvalidOperationException ex)
{
    Console.WriteLine($"Error: {ex.Message}");
}

// Stop when your app closes
await mellowtel.StopAsync();
Replace YOUR_CONFIGURATION_KEY with the configuration key from your Mellowtel dashboard.

Examples by Application Type

using MellowtelWin;

class Program
{
    static async Task Main(string[] args)
    {
        using var mellowtel = new Mellowtel("YOUR_CONFIG_KEY");

        if (!mellowtel.GetOptInStatus())
        {
            Console.WriteLine("User must opt in before using this service.");
            return;
        }

        using var cts = new CancellationTokenSource();
        Console.CancelKeyPress += (s, e) => { e.Cancel = true; cts.Cancel(); };

        try
        {
            await mellowtel.StartAsync(cts.Token);
            Console.WriteLine("Mellowtel running. Press Ctrl+C to stop.");
            await Task.Delay(Timeout.Infinite, cts.Token);
        }
        catch (InvalidOperationException ex)
        {
            Console.WriteLine($"Cannot start: {ex.Message}");
        }
        catch (OperationCanceledException)
        {
            Console.WriteLine("Stopping...");
        }
        finally
        {
            await mellowtel.StopAsync();
        }
    }
}

Displaying a consent dialog is mandatory. The SDK enforces this — StartAsync() throws an InvalidOperationException if the user hasn’t opted in.
var mellowtel = new Mellowtel("YOUR_CONFIG_KEY");

if (!mellowtel.GetOptInStatus())
{
    var userAgreed = ShowConsentDialog(); // your custom dialog

    if (userAgreed)
        mellowtel.OptIn();
    else
        return; // user declined — do not start
}

try
{
    await mellowtel.StartAsync();
}
catch (InvalidOperationException ex)
{
    Console.WriteLine($"Error: {ex.Message}");
}
1

Explain what Mellowtel does

Use plain language. Example: “This app uses Mellowtel to share your unused internet bandwidth. This allows you to [benefit/feature]. You can opt out at any time in settings.”
2

Give users a clear choice

Include distinct Accept and Decline options.
3

Link to policies

Include links to the Terms of Service and Privacy Policy.
// Check current status
bool isOptedIn = mellowtel.GetOptInStatus();

// Opt out
if (userWantsToOptOut)
{
    mellowtel.OptOut();
    await mellowtel.StopAsync();
}

// Opt back in
if (userWantsToOptIn)
{
    mellowtel.OptIn();
    await mellowtel.StartAsync();
}

Troubleshooting

  1. Verify nuget.config is in the correct location (the project root, next to .csproj or .sln)
  2. Check that the token has no extra spaces
  3. Clear the NuGet cache and retry:
dotnet nuget locals all --clear
dotnet restore
  1. Verify the token in nuget.config is correct
  2. Make sure there are no extra spaces around the token value

Estimated time to complete: 10–15 minutes. If you need help or have feedback, contact us at info@mellowtel.com or join our Discord community.