1.6.13 • Published 8 years ago

courtbot-engine v1.6.13

Weekly downloads
2
License
MIT
Repository
-
Last release
8 years ago

courtbot-engine Build Status npm npm Coverage Status

This repository is the meat of the courtbot functionality, intended to be require'd by a project that wants to implement courtbot.

Registration Source

In order to store and retreive registrations and sent-messages a registration source must be configured. The easiest way to do that is to use https://github.com/codefortulsa/courtbot-engine-pg to fill this role.

Example code to fulfill this requirement:

var courtbot = require("courtbot-engine");

courtbot.setRegistrationSource(function(connectionString) {
  return {
    getRegistrationById: function (id) {
      /* return the registration with the id provided */
      return Promise.resolve(regs);
    },
    getRegistrationsByContact: function(contact, communicationType) {
      /* return all registrations that are for the contact and type provided */
      return Promise.resolve(regs);
    },
    getRegistrationsByState: function (state) {
      /* return all registrations in the given state */
      return Promise.resolve(regs);
    },
    createRegistration: function (registration) {
      /* create a new registration and return its id */
      return Promise.resolve(1);
    },
    updateRegistrationName: function (id, name) {
      /* update the registration to the name provided */
      return Promise.resolve();
    },
    updateRegistrationState: function (id, state) {
      /* update the registration to state provided */
      return Promise.resolve();
    },

    getSentMessage: function (contact, communication_type, date, description) {
      /* get a matching sent message if it exists */
      return Promise.resolve(msg);
    },
    createSentMessage: function (contact, communication_type, date, description) {
      /* create a record of the sent message */
      return Promise.resolve();
    },
    migrate: function() {
      /* migrate to the most recent schema */
      return Promise.resolve();
    }
  };
});

Communication

For courtbot to talk to someone via a communication method, you have to add that method. The following methods exist:

Usage

Express

The following example adds the necessary routes to your express app:

app.use("/", courtbot.routes({ dbUrl: process.env.DATABASE_URL });

Console test prompt

To enable the console prompt in a local courbot instance, set the environment variable USE_CONSOLE=1. This will allow you to communicate with courtbot without using twilio.

Background Tasks

The following functions should be run on a regular basis, at least once per day:

  • sendDueReminders(options) - Sends reminders for cases that are within the reminder period.
  • checkMissingCases(options) - Looks for cases that were not initially found.
1.6.13

8 years ago

1.6.12

8 years ago

1.6.11

8 years ago

1.6.10

8 years ago

1.6.9

8 years ago

1.6.8

8 years ago

1.6.7

8 years ago

1.6.6

8 years ago

1.6.5

8 years ago

1.6.4

8 years ago

1.6.3

8 years ago

1.6.2

8 years ago

1.6.1

8 years ago

1.6.0

8 years ago

1.5.5

8 years ago

1.5.4

8 years ago

1.5.3

8 years ago

1.5.2

8 years ago

1.5.1

8 years ago

1.5.0

8 years ago

1.4.16

8 years ago

1.4.15

8 years ago

1.4.14

8 years ago

1.4.13

8 years ago

1.4.12

8 years ago

1.4.11

8 years ago

1.4.10

8 years ago

1.4.9

8 years ago

1.4.8

8 years ago

1.4.7

8 years ago

1.4.6

8 years ago

1.4.5

8 years ago

1.4.4

8 years ago

1.4.3

8 years ago

1.4.2

8 years ago

1.4.1

8 years ago

1.4.0

8 years ago

1.3.3

8 years ago

1.3.2

8 years ago

1.3.1

8 years ago

1.3.0

8 years ago

1.2.5

8 years ago

1.2.4

8 years ago

1.2.3

8 years ago

1.2.2

8 years ago

1.2.1

8 years ago

1.2.0

8 years ago

1.1.0

8 years ago

1.0.13-13

8 years ago

1.0.13-12

8 years ago

1.0.13-11

8 years ago

1.0.13-10

8 years ago

1.0.13-9

8 years ago

1.0.13-8

8 years ago

1.0.13-7

8 years ago

1.0.13-6

8 years ago

1.0.13-5

8 years ago

1.0.13-4

8 years ago

1.0.13-3

8 years ago

1.0.13-2

8 years ago

1.0.13-1

8 years ago

1.0.13-0

8 years ago

1.0.12

9 years ago

1.0.11

9 years ago

1.0.10

9 years ago

1.0.9

9 years ago

1.0.8

9 years ago

1.0.7

9 years ago

1.0.6

9 years ago

1.0.5

9 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago