Installs Letterbox in a Phoenix application.
$ mix igniter.install letterbox
or, with Letterbox already in the deps, mix letterbox.install.
Igniter shows each change as a diff
before it writes, and running the task again changes nothing:
the router has the ingresses' webhooks, in a pipeline of their own with no session and no CSRF token:
pipeline :webhooks do plug :accepts, ["json"] end scope "/inbound" do pipe_through :webhooks post "/webhooks/:ingress", Letterbox.Plug, [] endThe app's to change: the path, the scope and the pipeline (see
Letterbox.Plug). Run again, the task finds the route by its plug, wherever it is, and adds no other.the migration of Letterbox's table (
mix letterbox.gen.migration);.formatter.exsimports Letterbox's, so routes are writtenroute "support@", to: …;config :letterbox, repo: MyApp.Repo, routing: MyApp.Mailboxes;lib/my_app/mailboxes.ex, the routes, which give every message tolib/my_app/mailboxes/inbox.ex, a first mailbox that logs what it gets: the app's own files, written once;the application starts
Letterbox.Sweeperafter the repo: messages that were waiting are resumed, and those done with for 30 days are deleted.the endpoint's
Plug.Parserskeeps a webhook's body as it was sent, for its signature (PhoenixMountable.RawBody).
Then say how messages reach the app, in config/runtime.exs
(Letterbox.Ingress).