HTTP Event Server v0.2.6 HTTPEventServer.Endpoint View Source
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 :http_event_server,
api_token: System.get_env("API_TOKEN"),
task_module: YourTaskModule
Optionally, you can configure the response when a task is not found with the fail_on_no_event_found
config options. Setting it to true will return a 500 error
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.
Link to this section Summary
Link to this section Functions
Callback implementation for Plug.call/2
.
Callback implementation for Plug.init/1
.