Discord Widget

Creating / Previewing Discord Widget

Generate And Preview The Widget

GET https://api.twiz.lol/v3/widgets/${discordID}

Query Parameters

NameTypeDescription

apikey*

apikey

Get apikey from dashboard

{
    "name"="Wilson",
    "owner": {
        "id": "sha7891bikojbkreuy",
        "name": "Samuel Passet",
    "species": "Dog",}
    "breed": "Golden Retriever",
}

This API was originally exclusive only to Twiz.lol

Easiest Way to use Discord Widget

We are pleased to announce the addition of two new themes - Light Theme and Transparent Theme.

<!-- for dark theme -->
<iframe 
title="Discord user embed" 
width="340" height="72" 
frameborder="0" 
sandbox="allow-scripts" 
src="https://api.twiz.lol/v3/widgets/936249234510979183?apikey=apikey">
</iframe>
<!-- for light theme -->
<iframe 
title="Discord user embed" 
width="340" height="72" 
frameborder="0" 
sandbox="allow-scripts" 
src="https://api.twiz.lol/v3/widgets/936249234510979183?apikey=apikey&theme=light">
</iframe>
<!-- for transparent theme -->
<iframe 
title="Discord user embed" 
width="340" height="72" 
frameborder="0" 
sandbox="allow-scripts" 
src="https://api.twiz.lol/v3/widgets/936249234510979183?apikey=apikey&theme=trans">
</iframe>

Run/Build From Source?

Node is Required

Requirements: NodeJs 18^

let port = 1000;
const _ES = require('express')
const app = _ES();

// For API
let ApiKey = `10234895`;

app.get('/', (req, res) => {
  res.status(503).sendStatus(503);
})

// *
app.get('/widgets/', (req, res) => {
    res.send("Invalid ID");
    throw new Error('Invalid ID');
})
app.get('/widgets', (req, res) => {
    res.send("Invalid ID");
    throw new Error('Invalid ID');
})
// *
app.get('/widgets/:id', (req, res) => {
    try {
        const id = req.params.id;

        if (!id) {
            res.send("Invalid ID");
            throw new Error('Invalid ID');
        }
        // Powerd by twiz®
        const widgetUrl = `https://api.twiz.lol/v3/widgets/${id}?apikey=${ApiKey}`;

        const widgetHTML = `
            <iframe
                title="Discord user embed"
                width="340"
                height="72"
                frameborder="0"
                sandbox="allow-scripts"
                src="${widgetUrl}"
            ></iframe>
        `;

        res.send(widgetHTML);
    } catch (error) {
        console.error(error);
        res.status(500).send('Internal Server Error');
    }
});

app.listen(port, () => {
  console.log(`Server: Running`);
})

/*
@
-Credits to g0thub/sentiax
@
*/

/*
-- source code
https://github.com/Twiz-lol/WidgetsAPI-Source
*/

To run use:


npm install && npm run start

Last updated