# botbuilder-storage-postgres

> [![Github All Releases](https://img.shields.io/github/downloads/TDAmeritrade/botbuilder-storage-postgres/total.svg)][![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2FTDAmeritrade%2Fbotbuilder-storage-postgres.svg?type=shield)](https://

Latest version **1.1.3** (published 2020-03-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install botbuilder-storage-postgres
pnpm add botbuilder-storage-postgres
yarn add botbuilder-storage-postgres
bun add botbuilder-storage-postgres
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.3 |
| Published | 2020-03-02 |
| First published | 2019-06-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 185.8 KB |
| Known vulnerabilities | 0 (+5 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 15 |
| Maintainers | roeintense |

## Links

- npm: https://www.npmjs.com/package/botbuilder-storage-postgres
- Repository: https://github.com/TDAmeritrade/botbuilder-storage-postgres
- Homepage: https://github.com/TDAmeritrade/botbuilder-storage-postgres#readme
- Issues: https://github.com/TDAmeritrade/botbuilder-storage-postgres/issues
- npm.io page: https://npm.io/package/botbuilder-storage-postgres

## Dependencies (5)

- [pg](https://npm.io/package/pg.md) ^7.12.1
- [@types/pg](https://npm.io/package/@types/pg.md) ^7.11.2
- [pg-hstore](https://npm.io/package/pg-hstore.md) ^2.3.3
- [sequelize](https://npm.io/package/sequelize.md) ^5.21.2
- [botbuilder](https://npm.io/package/botbuilder.md) ^4.6.0

## Recent versions

- 1.1.3 (latest) — 2020-03-02
- 1.1.1 — 2019-10-31
- 1.1.0 — 2019-10-31
- 1.0.4 — 2019-10-03
- 1.0.3 — 2019-07-19
- 1.0.2 — 2019-06-24
- 1.0.1 — 2019-06-21
- 1.0.0 — 2019-06-21

## README

[![Github All Releases](https://img.shields.io/github/downloads/TDAmeritrade/botbuilder-storage-postgres/total.svg)][![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2FTDAmeritrade%2Fbotbuilder-storage-postgres.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2FTDAmeritrade%2Fbotbuilder-storage-postgres?ref=badge_shield)
() [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Twitter](https://img.shields.io/twitter/url/https/github.com/TDAmeritrade/botbuilder-storage-postgres.svg?style=social)](https://twitter.com/intent/tweet?text=Wow:&url=https%3A%2F%2Fgithub.com%2FTDAmeritrade%2Fbotbuilder-storage-postgres) [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2FTDAmeritrade%2Fbotbuilder-storage-postgres.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2FTDAmeritrade%2Fbotbuilder-storage-postgres?ref=badge_large)

# State Storage for Bot Framework using Postgres

This project provides a Postgres storage mechanism for [Bot Framework-JS SDK V4](https://github.com/Microsoft/botbuilder-js).

It allows you to store bot state in Postgres, so that you can scale out your bot, and be more resilient to bot server failures.

For more information about the botbuilder community, please visit [the botbuilder community project](https://github.com/BotBuilderCommunity/botbuilder-community-js).

## Requirements

-   [NodeJS](https://nodejs.org/en/) 10.x is a requirement to install dependencies, build and run tests.
-   Postgres database.

## Installation

```bash
npm install botbuilder-storage-postgres
```

## Sample Usage

```JavaScript
const postgresStorage = new PostgresStorage({
  uri : process.env.POSTGRES_URI
});

const conversationState = new ConversationState(postgresStorage);
```

Where `POSTGRES_URI` is set in `.env` or your secrets store of choice according to LibPQ Connection String standards. E.g.

`postgresql://[user[:password]@][netloc][:port][,...][/dbname][?param1=value1&...]`

## Configuration Options

| Field        | Description                                                    | Value      |
| ------------ | -------------------------------------------------------------- | ---------- |
| `uri`        | The Postgres connection URI                                    | _Required_ |
| `collection` | The name you'd like given to the table the bot will reference. | _Optional_ |
| `logging`    | Whether or not you want logging of transactions enabled.       | _Optional_ |

> &#X26A0; Caution: you **should not store postgres URI in code!** Get the `uri` from a configuration such as environment variable or a secrets store in your environment. It may contain sensitive password in the clear and should **never be stored in code**!

See [Postgres Connection URI format](https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING) in the official documentation to learn more about the connection `uri` parameter value.

---

\*

-   botbuilder-storage-postgres
-   Copyright 2019 TD Ameritrade. Released under the terms of the MIT license.
-   ***

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