# README
Chatblox
Overview
Chatblox is framework for building chatbots in Go.
This is a work in progress app and not ready for use.
Configuration
Set the following environment variables:
Variable | Type | Required | Notes |
---|---|---|---|
CHATBLOX_ENGINE | string | y | aws or nethttp |
CHATBLOX_PORT | integer | n | local port number for net/http |
CHATBLOX_REQUEST_FUZZY_AT_MENTION_MATCH | boolean | n | Match non-completed at mentions. |
CHATBLOX_RESPONSE_AUTO_AT_MENTION | boolean | n | |
CHATBLOX_POST_SUFFIX | string | n | |
GOOGLE_SERVICE_ACCOUNT_JWT | JSON string | y | |
GOOGLE_SPREADSHEET_ID | string | y | ID as in URL |
GOOGLE_SHEET_TITLE_RECORDS | string | y | sheet title for data records, e.g. Records |
GOOGLE_SHEET_TITLE_METADATA | string | y | sheet title for metadata, e.g. Metadata |
RINGCENTRAL_BOT_ID | string | y | bot personId in Glip |
RINGCENTRAL_BOT_NAME | string | y | bot name in Glip for fuzzy at matching |
RINGCENTRAL_SERVER_URL | string | y | Base API URL, e.g. https://platform.ringcentral.com |
RINGCENTRAL_TOKEN_JSON | JSON string | y | JSON token as returned by /oauth/token endpoint |
Using the AWS Engine
To use the AWS Lambda engine, you need an AWS account. If you don't hae one, the free trial account includes 1 million free Lambda requests per month forever and 1 million free API Gateway requests per month for the first year.
Installation via AWS Lambda
See the AWS docs for deployment:
https://docs.aws.amazon.com/lambda/latest/dg/lambda-go-how-to-create-deployment-package.html
Using the aws-cli
you can use the following approach:
$ cd ./apps/server
$ GOOS=linux go build main.go
$ zip main.zip ./main
# --handler is the path to the executable inside the .zip
$ aws lambda create-function --region us-east-1 --function-name Databot --memory 128 --role arn:aws:iam::account-id:role/execution_role --runtime go1.x --zip-file fileb://main.zip --handler main
Installation via AWS UI
API Gateway
- "Actions" > "Create Resource"
- Click "Configure as proxy resource"
- Click "Enable API Gateway CORS"
- Click "Create Resource"
- Add "Lambda Function"
- Click "Save"
- Click "Actions" > "Deploy API"
- Add "Stage name", e.g.
prod
,v1
, etc. - Create Webhook URL for
https://myId.execute-api.myRegion.amazonaws.com/v1/webhook
Keepalive
In production, there are are reasons why a RingCentral webhook may fail and become blacklisted. These should be tracked down an eliminated. If there are reasons to reenable the webhook, you can deploy the [rchooks
] RingCentral Lambda keepalive function: