lo ngu
lo ngu

Reputation: 1

How to use poe's API in any application ex nodejs?

I am a fresher in web development field.

I want to interact with Quora poe chat models as APIs in nodejs, somethings like put some question as request and get answer as response. How can I perform this?

I hope I could learn some ways to interact with API from random website.

Upvotes: 0

Views: 522

Answers (1)

kartik radadiya
kartik radadiya

Reputation: 191

Could you please try this package

npm i poe-chat-api

Then try to call like this :

const Client = require("poe-chat-api");
(async () => {
  const instance = new Client(process.env.TOKEN, {
    showSteps: true,
  });

  const client = await instance.init();

  await client.sendMessage(
    {
     // you can ask question as request here
      message: "Hello world",
    },
    (response) => {
      // here you can get answer as response
      console.log(response);
    },
  );
})();

Upvotes: 0

Related Questions