siftsciex_plug v0.3.0 Siftsciex.DecisionPlug
This Plug simplifies the handling of Decisions from Sift Science.
The Decision Plug basically performs three functions:
- Mapping specific endpoints to specific handlers in your code
- Verifying the signature in the request
- Processing the Decision body and automatically converting it to a
Siftsciex.Decision.t/0
struct
Configuration
There is a single piece of configuration to set. Sift Science sends a “signature” with each WebHook. It is recommended that you verify this signature, in fact this Plug will not process any requests that are not properly “signed”. The signature should be set in the :hook_key
attribute for the :siftsciex_plug
application.
config :siftsciex_plug,
hook_key: <sift_hook_sig>
Example
forward "/sift_science", Siftsciex.DecisionPlug, %{
"bad_listing" => {ListingHandler, :process}}
}