@logic-panda/sdk

LogicPanda AI + Javascript SDK

Usage no npm install needed!

<script type="module">
  import logicPandaSdk from 'https://cdn.skypack.dev/@logic-panda/sdk';
</script>

README

Build Status NPM Version js-standard-style

LogicPanda AI + Javascript SDK

logicpanda.app

Easily create text bots that humans can chat with on their preferred messaging platform.

-- ai.logicpanda.app

Installation

$ npm install @logic-panda/sdk

Integrations

Telegraf integration example

import Telegraf from 'telegraf';
import { TelegrafPanda } from '@logic-panda/sdk/integrations'

const telegraf = new Telegraf(BOT_TOKEN)
const panda = new TelegrafPanda(APP_KEY)

telegraf.on('text', (ctx) => {
  return panda.getMeaning(ctx.message.text)
    .then((result) => {
      // reply to user with wit result
      return ctx.reply(JSON.stringify(result, null, 2))
    })
})

telegraf.startPolling()

There are some other examples.

Error Handling

To perform custom error-handling, you can set onError handler:

panda.on('error', (ctx) => {
  console.error('error', err)
}