How to white label your Hello Knowledge Base for branding ?

White labelling allows you the flexibility to use various web addresses for your Knowledge Base.


For Example:  Your Knowledge Base will be available on https://kb.phone91.com/{{company_short_code}}/{{article_slug}}

but if you want it to be present on your own domain also like thingsofbrand.com   then you can follow the given steps:


For Cloudflare:


Open your Cloudflare Account and Select the domain for which you want to use for Knowledge Base. For Example in provided image we will use thingsofbrand.com as our domain





a. ) Configure using subdomain:


    A subdomain is like a separate neighborhood on the internet, adding a specific prefix to your domain for organizing and directing web traffic. 



For Example: If you want to deploy your Knowledge Base on URL  help.thingsofbrand.com , here help is the subdomain.


   Step 1 :  Go to Configurations page of Knowledge Base and select domain tab


Add Your Custom domain including its subdomain





         

   Step 2: Click DNS, then Records, and add a record.


   A DNS CNAME (Canonical Name) record is used to associate a subdomain with another domain, providing an alias that redirects to the specified domain or host.  




                   



   Step 3: Add Record by filling type name and target

               


 


               




b. ) Configure using endpoint:


An endpoint is like a specific address on the internet, guiding web requests to a designated location or function on a website or server. 


For Example: If you want to deploy your Knowledge Base on thingsofbrand.com/help


Step 1 :  Go to Configurations page of Knowledge Base and select domain tab


Add Your Custom Domain and Endpoint 





Step 2: Select Worker routes from the main page:



            


Step 3 : Click Manage Workers:


Cloudflare Workers optimize website performance and security by allowing you to run serverless functions at the DNS level, enabling powerful customization and enhancement of web requests. 







Step 4: Click Create Application:


Cloudflare Workers/application offer serverless edge computing, letting developers execute code globally for faster responses. Enhance website performance, adapt to HTTP requests dynamically, and optimize user experiences effortlessly. 


         



Step 5: Click Quick edit and to open a worker.js file:



The worker.js file serves as the script where you write code to be executed by Cloudflare Workers. It defines the behavior and tasks your serverless functions will perform at the edge of the network. 



Quick Edit 


Worker JS file



Step 6: Add the provided code into the file, modifying the variables. 



addEventListener('fetch', event => {
  var url = new URL(event.request.url);
  if (url.pathname.startsWith('/{{your_endpoint}}/') ||
 url.pathname === '/{{your_endpoint}}') {
    event.respondWith(handleBlog(event, url));
  } else {
    event.respondWith(fetch(event.request));
  }})

async function handleBlog(event, url) {
  var originUrl = url.toString().replace(
    
'https://{{your_custom_domain}}/{{your_endpoint}}',
   'https://kb.phone91.com/{{your_company_short_code}}');
  const response = await fetch(originUrl, event.request);
  return response; }


Variable Reference: 


your_company_short_code: refers to Company Short code configure in MSG91 KB Configurations page
your_custom_domain: refers to your Custom domain

your_endpoint: refers to path after custom domain where you want to publish Knowledge Base . Example : example.com/{{endpoint}}


 



Step 7:Add a route to the Worker in the Worker routes Page pointing to the application/worker you created.



Worker routes associate specific URLs with Cloudflare Workers, determining when and how the serverless code should be executed for enhanced web performance and dynamic content delivery. 


                     




These Steps may vary for other DNS providers, so please check with your DNS provider for support