{"id":19237203,"url":"https://github.com/tdameritrade/botbuilder-storage-postgres","last_synced_at":"2025-09-08T13:37:41.388Z","repository":{"id":39916702,"uuid":"192953604","full_name":"TDAmeritrade/botbuilder-storage-postgres","owner":"TDAmeritrade","description":"Botbuilder adapter for Postgres NoSQL storage.","archived":false,"fork":false,"pushed_at":"2024-09-18T16:42:50.000Z","size":1730,"stargazers_count":14,"open_issues_count":11,"forks_count":7,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-16T21:56:31.750Z","etag":null,"topics":["bot-builder","javascript-library","nosql","postgres","storage-adapter"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TDAmeritrade.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"Contributing.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-06-20T16:28:52.000Z","updated_at":"2024-09-18T16:41:32.000Z","dependencies_parsed_at":"2024-11-27T14:30:37.891Z","dependency_job_id":null,"html_url":"https://github.com/TDAmeritrade/botbuilder-storage-postgres","commit_stats":{"total_commits":63,"total_committers":5,"mean_commits":12.6,"dds":"0.31746031746031744","last_synced_commit":"6fb32ab3bcff1c2f36fadf7573eeeed21081cefb"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TDAmeritrade%2Fbotbuilder-storage-postgres","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TDAmeritrade%2Fbotbuilder-storage-postgres/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TDAmeritrade%2Fbotbuilder-storage-postgres/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TDAmeritrade%2Fbotbuilder-storage-postgres/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TDAmeritrade","download_url":"https://codeload.github.com/TDAmeritrade/botbuilder-storage-postgres/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250002321,"owners_count":21359094,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bot-builder","javascript-library","nosql","postgres","storage-adapter"],"created_at":"2024-11-09T16:25:25.356Z","updated_at":"2025-04-21T05:32:49.648Z","avatar_url":"https://github.com/TDAmeritrade.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"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)\n() [![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:\u0026url=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)\n\n# State Storage for Bot Framework using Postgres\n\nThis project provides a Postgres storage mechanism for [Bot Framework-JS SDK V4](https://github.com/Microsoft/botbuilder-js).\n\nIt allows you to store bot state in Postgres, so that you can scale out your bot, and be more resilient to bot server failures.\n\nFor more information about the botbuilder community, please visit [the botbuilder community project](https://github.com/BotBuilderCommunity/botbuilder-community-js).\n\n## Requirements\n\n-   [NodeJS](https://nodejs.org/en/) 10.x is a requirement to install dependencies, build and run tests.\n-   Postgres database.\n\n## Installation\n\n```bash\nnpm install botbuilder-storage-postgres\n```\n\n## Sample Usage\n\n```JavaScript\nconst postgresStorage = new PostgresStorage({\n  uri : process.env.POSTGRES_URI\n});\n\nconst conversationState = new ConversationState(postgresStorage);\n```\n\nWhere `POSTGRES_URI` is set in `.env` or your secrets store of choice according to LibPQ Connection String standards. E.g.\n\n`postgresql://[user[:password]@][netloc][:port][,...][/dbname][?param1=value1\u0026...]`\n\n**NOTE** Make sure to encode special characters in the password. More details on [percent encoding](https://en.wikipedia.org/wiki/Percent-encoding#Reserved_characters)\n\n### Methods\n\nThe `conversationState` declared above would have three methods attached: \n* [read](https://github.com/TDAmeritrade/botbuilder-storage-postgres/blob/99e3cb39e27abf18c2e187ee572652a80e99862d/src/PostgresStorage.ts#L102). Signature: `async read(stateKeys: string[]): Promise\u003cStoreItems\u003e`\n* [write](https://github.com/TDAmeritrade/botbuilder-storage-postgres/blob/99e3cb39e27abf18c2e187ee572652a80e99862d/src/PostgresStorage.ts#L117). Signature: `async write(changes: StoreItems): Promise\u003cvoid\u003e`\n* [delete](https://github.com/TDAmeritrade/botbuilder-storage-postgres/blob/99e3cb39e27abf18c2e187ee572652a80e99862d/src/PostgresStorage.ts#L156). Signature: `async delete(keys: string[]): Promise\u003cvoid\u003e`\n\nFor information about the types expected and returned with each method, please check out the source and read the [Microsoft Storage Interface](https://docs.microsoft.com/en-us/javascript/api/botbuilder-core/storage?view=botbuilder-ts-latest) documentation. \n\n## Configuration Options\n\n| Field        | Description                                                    | Value      |\n| ------------ | -------------------------------------------------------------- | ---------- |\n| `uri`        | The Postgres connection URI                                    | _Required_ |\n| `collection` | The name you'd like given to the table the bot will reference. | _Optional_ |\n| `logging`    | Whether or not you want logging of transactions enabled.       | _Optional_ |\n\n\u003e \u0026#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**!\n\nSee [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.\n\n---\n\n\\*\n\n-   botbuilder-storage-postgres\n-   Copyright 2019 TD Ameritrade. Released under the terms of the MIT license.\n-   ***\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftdameritrade%2Fbotbuilder-storage-postgres","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftdameritrade%2Fbotbuilder-storage-postgres","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftdameritrade%2Fbotbuilder-storage-postgres/lists"}