Codelation Messenger v0.1.1 CodelationMessenger.Router
Forward requests to this router by forward "/message", to: Messenger.Router
. This will capture
POST requests on the /message/:task
route calling the task specified. In your config, you will need
to add the following options:
config :messenger,
api_token: System.get_env("API_TOKEN"),
task_module: YourTaskModule
You will need to define a task module that has a handle(message, data)
function. This function
needs to return either {:ok, %{}} or {:error, %{}}. If not, this will automatically return a 500 error.
You can send messages to this router by sending a POST
request with a JSON
body and an
Authorization Bearer token
header.
Summary
Functions
Callback implementation for Plug.call/2
.
Callback implementation for Plug.init/1
.