clevy/csml-engine

By clevy

Updated over 3 years ago

Run chatbots on premise with CSML Engine!

Image
0

2.6K

clevy/csml-engine repository overview

CSML Engine Server

Run CSML Conversational Engine on premise!

Installation

Docker

The easiest way to start a CSML Engine Server is by using our pre-built docker container. To do that, make sure that you have a mongodb database ready and that you have correctly setup a .env file accordingly (see .env.example for reference).

docker run -p 3000:3000 --env-file .env clevy/csml-engine
Docker-compose

If you also need to start a MongoDB server, you can also use our docker-compose.yml configuration by running:

docker-compose up -d

Tweak the docker-compose.yml file to your liking. You can use a different MongoDB instance by setting the right environment variables (cf .env.example).

Usage

Verify that CSML Engine is running by calling http://localhost:5000 (or any other port configured in your .env file). You can find a complete API documentation in Swagger/OpenAPI format on the main repository: https://github.com/CSML-by-Clevy/csml-engine/blob/master/csml_server/swagger.yaml

POST /run

Handle incoming events

curl -X "POST" "http://localhost:5000/run" \
     -H 'content-type: application/json' \
     -d $'{
  "bot": {
    "default_flow": "Default",
    "id": "mybot",
    "flows": [
      {
        "id": "e0a13373-2037-4590-8018-ab14e74b27a1",
        "content": "start:\\n\\tsay \\"Hello\\"\\n\\tgoto end",
        "commands": [
          "/default"
        ],
        "name": "Default",
        "description": "Default custom flow"
      }
    ],
    "updated_at": "2020-05-28T17:57:20.725Z",
    "name": "MySuperBot"
  },
  "event": {
    "request_id": "d7077041-c81a-4872-820c-dc23e015aa84",
    "client": {
      "user_id": "myuser",
      "channel_id": "mychan",
      "bot_id": "mybot"
    },
    "payload": {
      "content_type": "text",
      "content": {
        "text": "Hi there"
      }
    },
    "metadata": {
      "some": "info",
      "about": "the current user"
    }
  }
}'

Note: if body.event.callback_url is set, any message issued by the bot will be sent in real-time to this endpoint as a POST HTTP request.

POST /conversations/open

Retrieve the given client's last open conversation

curl -X "POST" "http://localhost:5000/conversations/open" \
     -H 'content-type: application/json' \
     -d $'{
  "user_id": "myuser",
  "channel_id": "mychannel",
  "bot_id": "mybot"
}'
POST /conversations/close

Close all open conversations of the given client

curl -X "POST" "http://localhost:5000/conversations/close" \
     -H 'content-type: application/json' \
     -d $'{
  "user_id": "myuser",
  "channel_id": "mychannel",
  "bot_id": "mybot"
}'
POST /bots/validate

Verify that the given bot contains valid CSML

curl -X "POST" "http://localhost:5000/bots/validate" \
     -H 'content-type: application/json' \
     -d $'{
  "id": "mybot",
  "default_flow": "Default",
  "flows": [
    {
      "commands": [
        "/default"
      ],
      "content": "start:\\n\\tsay \\"Hello\\"\\n\\tgoto end",
      "id": "some-random-id",
      "name": "Default"
    }
  ],
  "name": "MySuperBot"
}'

Tag summary

Content type

Image

Digest

sha256:a31082699

Size

79.2 MB

Last updated

over 3 years ago

docker pull clevy/csml-engine:v1.11.2