Posting chat message from discourse chat bot to some API

I have been trying to figure out that how can we post discourse bot chat message to some API? Is there any way to this?

I’ve been working on this lately.

I wrote a bot to synchronize messages in both directions between my discourse chat channel and telegram group - and then to simplify the code, I created this API. Maybe it will help you?

const { DiscourseApi } = require("node-discourse-api");

const api = new DiscourseApi("");

// API configured by Discourse administrator. You can also leave it unset and have the API read only the public content of your forum.
api.options.api_username = "API_USERNAME";
api.options.api_key = "API_KEY";
// Send a message in channel 2. Probably, it's #general, "hello, world!");