Skip to content

MeuPluggyAi webhook is not receiving clientUserId from Pluggy Connect item connection #27

@oallanmendes

Description

@oallanmendes

Issue Summary

When creating item connections through the MeuPluggyAi connector using Pluggy Connect, the clientUserId is correctly passed during widget initialization via options.clientUserId, but this value is not being propagated to webhook payloads.

This prevents us from reliably associating webhook events with the originating platform user.

Current Implementation

We are explicitly setting clientUserId when generating the connect token and initializing Pluggy Connect:

Generate Connection Token via my backend in route post "/pluggy/connect-token", PluggyTokenController, :create

Controller responds with accessToken and options.clientUserId

def create(conn, _params) do
client_user_id = conn.assigns.current_scope.user.id |> to_string()

# get api key
# generate connect_token

json(conn, %{
  accessToken: connect_token,
  options: %{
    clientUserId: client_user_id,
    avoidDuplicates: true
  }
})

end

Plain JS via LiveView receives accessToken and options, then forwards them to Pluggy Connect

new window.PluggyConnect({
  connectToken: accessToken,
  options,
  includeSandbox: true,
})

Pluggy Connect onSuccess callback also returns clientUserId as null

onSuccess: (itemData) => {
console.log(itemData) // clientUserId is null
// TODO: Implement logic for successful connection
// The following line is an example, it should be removed when implemented.
console.log('Yay! Pluggy connect success!', itemData)
},

Webhook parameters received.

[debug] Processing with MyAppWeb.PluggyWebhookController.create/
Parameters: %{
"clientId" => "d4d7fe2a-40b5-4a63-8141-123", 
"clientUserId" => nil, 
"event" => "item/created", 
"eventId" => "9f549edd-5de5-4145-8776-123", 
"id" => "15ac9c7e-f39e-4b55-b8a8-123", 
"itemId" => "15ac9c7e-f39e-4b55-b8a8-123", 
"triggeredBy" => "USER"}
Pipelines: [:api]

Expected Behavior

When a user connects an item through MeuPluggyAi:

  • clientUserId should persist through the item lifecycle
  • clientUserId should be available in webhook events related to that item
  • Webhook payloads should allow us to map Pluggy events back to our internal user

Current Behavior

  • Connection flow works successfully
  • Item is created
  • Webhooks are received
  • clientUserId is missing from webhook payloads for MeuPluggyAi connections

Why This Matters

Without clientUserId in webhook events:

  • User-to-item reconciliation becomes harder
  • Webhook processing requires additional lookup layers
  • Multi-tenant user attribution becomes less reliable
  • Connector behavior is inconsistent with expected Pluggy identity propagation

Reference

A similar issue was previously fixed for MercadoPago, where clientUserId was not being propagated to item connections:

“Fixed clientUserId not being propagated to item connections for MercadoPago connector.”

Request

Please confirm whether clientUserId propagation is currently unsupported or unintentionally broken for MeuPluggyAi item connections, specifically for item/created flows, and whether the MercadoPago connector fix can be replicated.

Reproduction Summary

  1. Backend sets options.clientUserId
  2. Pluggy Connect initializes successfully
  3. Item is created successfully
  4. onSuccess.itemData.clientUserId returns null
  5. item/created webhook returns "clientUserId" => nil

Additional Context

This appears connector-specific, since clientUserId is being explicitly provided during Pluggy Connect initialization, but is not present downstream in webhook notifications.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions