Apple Intents fulfillment guide

Copy Markdown View Source

Packages

  • apple_intents — production webhook library (Phoenix/Plug/Oban/custom).
  • apple_intents_jido — optional Jido.Exec orchestrator.

Core modules

ModulePurpose
AppleIntentsFacade — verify_and_handle/3, approve/3, privacy helpers
AppleIntents.FulfillmentMain entry point
AppleIntents.JWSES256 verification, signedPayload extraction
AppleIntents.IntentHandler behaviour + use macro
AppleIntents.DelegatedZero-boilerplate delegation
AppleIntents.RouterIntent registry + dispatch
AppleIntents.OrchestrationDry-run, approval, orchestrator dispatch
AppleIntents.PlugFulfillment webhook
AppleIntents.ApprovalPlugHuman approval callback

Delegation without Jido

defmodule MyApp.IntentRouter do
  use AppleIntents.Router

  def orchestrator, do: MyApp.ObanOrchestrator

  handlers do
    [MyApp.PhotoIntent]
  end
end

See apple_intents/examples/oban_orchestrator.ex for an Oban pattern.

Approval webhook

post "/apple/intents/approve", AppleIntents.ApprovalPlug,
  init_opts: [router: MyApp.IntentRouter]

Callback params: intent_id, request_id, approved, parameters.

Publishing

Both packages ship at v0.1.0 from this monorepo:

  1. cd apple_intents && mix hex.publish
  2. cd apple_intents_jido && mix hex.publish (depends on apple_intents ~> 0.1.0)