# botkit-storage-pg

> Postgres storage driver for botkit

Latest version **0.2.2** (published 2018-08-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install botkit-storage-pg
pnpm add botkit-storage-pg
yarn add botkit-storage-pg
bun add botkit-storage-pg
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.2 |
| Published | 2018-08-21 |
| First published | 2018-05-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8.0 |
| Dependencies | 1 |
| Unpacked size | 8.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Vu Thanh Tam |
| Maintainers | rush1506 |
| Keywords | botkit, postgres, botkit-storage |

## Links

- npm: https://www.npmjs.com/package/botkit-storage-pg
- Repository: https://github.com/rush1506/botkit-storage-pg
- Homepage: https://github.com/rush1506/botkit-storage-pg.git
- Issues: https://github.com/rush1506/botkit-storage-pg/issues
- npm.io page: https://npm.io/package/botkit-storage-pg

## Dependencies (1)

- [pg](https://npm.io/package/pg.md) ^7.4.3

## Alternatives

- [localforage](https://npm.io/package/localforage.md) — 6.2M weekly downloads
- [localforage-observable](https://npm.io/package/localforage-observable.md) — 30.8K weekly downloads
- [@y/y](https://npm.io/package/@y/y.md) — 30.1K weekly downloads
- [@metaobjectsdev/render](https://npm.io/package/@metaobjectsdev/render.md) — 3.5K weekly downloads
- [@ledgerhq/coin-algorand](https://npm.io/package/@ledgerhq/coin-algorand.md) — 1.1K weekly downloads

## Recent versions

- 0.2.2 (latest) — 2018-08-21
- 0.2.1 — 2018-08-21
- 0.1.9 — 2018-08-21
- 0.1.7 — 2018-08-21
- 0.1.5 — 2018-08-21
- 0.1.3 — 2018-08-21
- 0.1.1 — 2018-05-17
- 0.1.0 — 2018-05-17

## README

# botkit-storage-postgres

Postgres storage module for Botkit

## Install

Install with npm

```
npm install botkit-storage-pg --save
```

## Usage

If you're using botkit starter pack, you can do it in the `bot.js` file by adding config to it

For `Heroku` user with Uri:

```
if (isCustomStorage) {
  let dboptions = {
    connectionString: "Uri"
  };
  var storage = require('botkit-storage-pg')(dboptions);
  bot_options.storage = storage;
} else {
  console.log("Without a db, the bot will require reauthen when the server is restart");
  bot_options.json_file_store = __dirname + '/.data/db/'; // store user data in a simple JSON format
}
```

For user with normal option:

```
if (isCustomStorage) {
  let dboptions = {
    host: 'localhost',
    user: 'botkit',
    password: 'botkit',
    database: 'botkit',
    port: 'port'
  };
  var storage = require('botkit-storage-pg')(dboptions);
  bot_options.storage = storage;
} else {
  console.log("Without a db, the bot will require reauthen when the server is restart");
  bot_options.json_file_store = __dirname + '/.data/db/'; // store user data in a simple JSON format
}
```

If you're implementing botkit from scratch

For Uri:

```
var botkit_storage_pg = require('botkit-storage-pg');
var Botkit = require('botkit');

var controller = Botkit.slackbot({
  storage: botkit_storage_pg({
     connectionString: "Uri"
  })
});
```

For normal option:

```
var botkit_storage_pg = require('botkit-storage-pg');
var Botkit = require('botkit');

var controller = Botkit.slackbot({
  storage: botkit_storage_pg({
    host: 'localhost',
    user: 'botkit',
    password: 'botkit',
    database: 'botkit',
    port: 'port'
  })
});
```
### Requirements
* Node 8.0 or later
* Postgres 10.0 or later

---
_Source: https://npm.io/package/botkit-storage-pg · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
