[] BotDash Custom Domain Setup (Requires Premium)

With Inventor Premium, you can connect a domain you already own to your BotDash website. Everything (the marketing website and dashboard) will be fully private-labeled on your own domain.

You will not be able to complete setup with a custom domain if your bot does not have an active Premium subscription, and your custom domain will be deactivated if your Premium subscription expires. Your free subdomain (yourbot.botdash.tld) will always be available regardless of your subscription status. We require you to keep a free subdomain so there’s something to fall back to if your Premium expires.

Prerequisites

This guide assumes:

  • You have already purchased a domain
  • You are subscribed to Inventor Premium
  • You have already registered a free BotDash subdomain and created a homepage

Setting up a custom domain can be somewhat complex, feel free to contact us if you have any questions.

Connect Domain to Cloudflare

If you haven’t already, go to Cloudflare and create a free account, then follow the steps to add your domain. Use their free tier to add your domain.

Please keep in mind that DNS can take up to 24 hours to propogate (although it is often much quicker), and your DNS servers can cache old/invalid results for up to 24 hours.

If you are have an issue where you are still seeing a old page from before setting up Cloudflare, try purging your computer’s DNS cache, use another device or a VPN, or wait a few hours and try again.

Setup Cloudflare Workers

Once you have connected your domain and it is showing up as successfully added, go to the Workers Page of the Cloudflare dashboard.

You will be prompted to setup an account subdomain and to pick a plan. Choose the free plan, and set the subdomain to something representitive of your bot.

Your subdomain may be exposed to technical users in some cases, so don’t set it to anything sensitive. This can usually just be your bot’s name.

Create a Cloudflare Worker

Click here to create the “Hello World” worker. We’d suggest setting the name to something like inventor or botdash so you don’t forget, but the name doesn’t matter.

Click Deploy, then click Edit Code on the success page.

If this isn’t your first worker, you might just be sent to the Worker’s overview page. If this happens (or you need to come back and edit your worker in the future), click the Quick Edit button on the far right side of the top menu bar. On some mobile devices, you may need to scroll the menu bar to see the option.

Paste Code into Worker

On the left side of the editor, delete the sample code, and paste this code:

// Go to https://inventor.gg/botdash/settings/domain
// Copy the "Worker Secret" from the bottom of the page
// Paste it inside the single quotes on the next line:
const SECRET = '[PASTE SECRET HERE]';

// =====================================
// BOTDASH Cloudflare Worker Proxy v1.0.0
// DO NOT MODIFY THE CODE BELOW
// https://forum.inventor.gg/t/botdash-custom-domain-setup-requires-premium/69
// =====================================

addEventListener('fetch', event => {
  event.respondWith(handleRequest(event.request));
})
async function handleRequest(request) {
  const url = new URL(request.url);
  let modifiedRequest = new Request(request, {
    headers: new Headers(request.headers)
  });
  modifiedRequest.headers.set('X-BD-ScriptVersion', 'v1.0.0');
  modifiedRequest.headers.set('X-BD-Hostname', url.hostname);
  modifiedRequest.headers.set('X-BD-Secret', SECRET);
  return fetch('https://domain.botda.sh' + url.pathname + url.search, modifiedRequest);
}

Get Secret

Go to BotDash Domain Settings. If you haven’t already, type in your domain name.

Then, copy-paste the value from the “Worker Secret” field into the top of the Worker script.

It should look something like this when you’re done:

const SECRET = 'aaaaaa-aaaa-aaaa-aaaa-aaaaaaaaa-aaaa-aaaa-aaaaaaaaaaaa';

This step is required and your website will not work without it. Do not share your secret.

Once you’ve set the secret, click Save and Deploy in the top-right hand corner of the Cloudflare Worker editor, then confirm on the pop-up.

Connect Worker to Domain

Click the back arrow at the top-left hand corner of the Worker editor page. You’ll go to the worker overview page.

From there, click the “Triggers” tab, then click “Add Custom Domain”. Enter the domain name you wish to use. Click “Add Custom Domain” again, and it should activate within a few minutes.

Navigate to Domain

Open your custom domain in a new browser tab. You should see your BotDash site’s homepage.

You must have a subdomain for a botdash domain at all times, even if you are using a custom domain. Once you setup a custom domain, changing your BotDash subdomain will result in your custom domain being disconnected from Inventor.

If this happens, you won’t need to go through the entire setup process again, just re-typing in your custom domain, and possibly updating your secret (if it regenerates).

“Almost There” Page

If you see a “Almost there!” screen from BotDash when nagivating to your website, here’s what to do:

Open the BotDash Domain Settings page and copy/paste the domain name from the “Almost there!” screen to the BotDash settings screen, then click save on the settings page.