   def handle_in("decorated", payload, socket) do
     {:reply, {:ok, payload}, socket}
   end
+end
 
-  @decorate channel_action()
-  def handle_in("decorated_with_unbound_payload", _, socket) do
-    {:reply, :ok, socket}
-  end
+defmodule InstrumentedPhoenixChannel do
+  import Appsignal.Phoenix.Channel, only: [channel_action: 5]
+  use Appsignal.Instrumentation.Decorators
 
   def handle_in("instrumented" = action, payload, socket) do
     channel_action(__MODULE__, action, socket, payload, fn ->

    assert [%Appsignal.Transaction{id: "123"}] = FakeTransaction.completed_transactions(fake_transaction)
  end

  test "instruments a channel action with an instrumentation helper", %{socket: socket, fake_transaction: fake_transaction} do
    UsingAppsignalPhoenixChannel.handle_in("instrumented", %{"body" => "Hello, world!"}, socket)

    assert [{"123", :channel}] == FakeTransaction.started_transactions(fake_transaction)
    assert "UsingAppsignalPhoenixChannel#instrumented" == FakeTransaction.action(fake_transaction)
    assert %{
      "environment" => %{
        channel: PhoenixChatExampleWeb.RoomChannel,

  end

  test "filters parameters", %{socket: socket, fake_transaction: fake_transaction} do
    AppsignalTest.Utils.with_config(%{filter_parameters: ["password"]}, fn ->
      InstrumentedPhoenixChannel.handle_in("instrumented", %{"password" => "secret"}, socket)
      assert "[FILTERED]" == FakeTransaction.sample_data(fake_transaction)["params"]["password"]
    end)
  end
