CP4M is a conversational marketing platform which enables advertisers to integrate their customer-facing chatbots with FB Messenger/WhatsApp, in order to meet customers where they are and drive native conversations on the advertiser's owned infra.
CP4M acts as a bridge between existing Messenger and Whatsapp APIs and existing LLM APIs (OpenAI, LLaMa, etc.)
Almost all of CP4M's configurations are set via a configuration file. This file can be in either JSON or TOML format, we use TOML here for brevity.
$ mkdir /tmp/cp4m
$ touch /tmp/cp4m/cp4m.toml
port = 8080
[[plugins]]
name = "openai_test"
type = "openai"
model = "gpt-3.5-turbo"
api_key = "<your api key here>"
[[stores]]
name = "memory_test"
type = "memory"
storage_duration_hours = 1
storage_capacity_mbs = 1
[[handlers]]
name = "whatsapp_test"
type = "whatsapp"
verify_token = "<your verification token here>"
app_secret = "<your verification app secret here>"
access_token = "<you access token here>"
[[pre_processors]]
type = "aws_s3"
name = "aws_s3"
aws_access_key_id="<your-aws-console-access-key>"
aws_secret_access_key="<your-aws-console-secret-key>"
region = "<your-aws-s3-bucket-region>"
bucket = "<your-aws-bucket-name>"
[[services]]
webhook_path = "/<webhook-pathname>"
plugin = "openai_test"
store = "memory_test"
handler = "whatsapp_test"
pre_processors =["aws_s3"]
port = 8080
[[plugins]]
name = "hf_test"
type = "hugging_face"
endpoint = "https://example.com"
token_limit = 1000
api_key = "<your api_token here>"
[[stores]]
name = "memory_test"
type = "memory"
storage_duration_hours = 1
storage_capacity_mbs = 1
[[handlers]]
type = "messenger"
name = "messenger_test"
verify_token = "<your verification token here>"
app_secret = "<your verification app secret here>"
page_access_token = "<your page access token here>"
[[services]]
webhook_path = "/<webhook-pathname>"
plugin = "hf_test"
store = "memory_test"
handler = "messenger_test"
We provide a Dockerfile to build and run CP4M however you're also welcome to follow the steps in the Dockerfile to build locally.
$ git clone git@github.com:facebookincubator/CP4M.git
The below commands changes your directory to the CP4M directory, builds a docker image named cp4m
and then runs that
images and exposing the port 8080 for webhooks.
$ cd CP4M
$ docker build -t cp4m .
$ docker run -v /tmp/cp4m:/tmp/cp4m -e CP4M_CONFIGURATION_FILE=/tmp/cp4m/cp4m.toml -p 8080:8080 cp4m
CP4M is MIT licensed.