JavaScript (Fetch, Native, Axios)

Use the following examples only on server side (backend). Dont' expose values of the {channel}, specially {token} on the client (front-end).

Please replace {channel}, {token} and data argument.

Fetch

const bugify = (channel, data = '') => {
    var token = '{token}',
        myHeaders = new Headers();

    myHeaders.append("Content-Type", "text/plain");
    myHeaders.append("Authorization", "Bearer " + token);

    var requestOptions = {
        method: 'POST',
        headers: myHeaders,
        body: data,
        redirect: 'follow'
    };

    fetch("https://push.bugify.io/" + channel, requestOptions)
        .then(response => response.text())
        .then(result => console.log(result))
        .catch(error => console.log('error', error));
}

bugify('{channel}', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.');

Native

import https from "node:https";

const bugify = (channel, data = '') => {

    var token = '{token}';

    var options = {
        'method': 'POST',
        'hostname': 'push.bugify.io',
        'port': 443,
        'path': '/' + channel,
        'headers': {
            'Content-Length': data.length,
            'Content-Type': 'text/plain',
            'Authorization': 'Bearer ' + token
        },
        'maxRedirects': 20
    };

    var req = https.request(options, function (res) {
        var chunks = [];

        res.on("data", function (chunk) {
            chunks.push(chunk);
        });

        res.on("end", function (chunk) {
            var body = Buffer.concat(chunks);
            console.log(body.toString());
        });

        res.on("error", function (error) {
            console.error(error);
        });
    });

    req.write(data);
    req.end();
}

bugify('{channel}', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.');

Axios

First install axios: npm install axios -D

import axios from "axios";

const bugify = (channel, data = '') => {

    let token = '{token}';

    let config = {
        method: 'post',
        maxBodyLength: Infinity,
        url: 'https://push.bugify.io/' + channel,
        headers: {
            'Content-Type': 'text/plain',
            'Authorization': 'Bearer ' + token
        },
        data: data
    };

    axios.request(config)
        .then((response) => {
            console.log(JSON.stringify(response.data));
        })
        .catch((error) => {
            console.log(error);
        });
}

bugify('{channel}', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.');