Skip to content

feat: add api_integration tracking to Dify and n8n integrations#10

Merged
hwennnn merged 1 commit intomainfrom
feat/track-integrations-origin
Mar 12, 2026
Merged

feat: add api_integration tracking to Dify and n8n integrations#10
hwennnn merged 1 commit intomainfrom
feat/track-integrations-origin

Conversation

@hwennnn
Copy link
Copy Markdown
Contributor

@hwennnn hwennnn commented Mar 12, 2026

Summary

  • Adds api_integration field to the request body payload for both Dify ("dify") and n8n ("n8n") integrations
  • Enables usage attribution in PostHog so we can track which integration surface API calls originate from
  • Matches the backend schema where request_origin is 'api' and api_integration specifies the client (per London's implementation in mino)

Changes

  • dify/tools/base.py — Added "api_integration": "dify" to _build_automation_payload(), covering run, run-async, and run-sse endpoints
  • n8n/nodes/Tinyfish/GenericFunctions.ts — Added api_integration: 'n8n' to buildAutomationPayload(), covering all automation requests including SSE

Test plan

  • Verify Dify plugin sends api_integration: "dify" in request body for all automation endpoints
  • Verify n8n node sends api_integration: "n8n" in request body for all automation endpoints
  • Confirm api_integration appears in PostHog run_completed events after backend processes these requests

🤖 Generated with Claude Code

Enables usage attribution by sending api_integration in the request
body so the backend can track which integration surface API calls
originate from (e.g., "dify", "n8n") in PostHog analytics.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 12, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 100f422e-91e5-40b0-866a-64bb2e9bdb74

📥 Commits

Reviewing files that changed from the base of the PR and between 4e53a9c and 7ddb7f3.

📒 Files selected for processing (2)
  • dify/tools/base.py
  • n8n/nodes/Tinyfish/GenericFunctions.ts

📝 Walkthrough

Walkthrough

The changes add an api_integration field to automation payloads across two integration implementations. In the Dify integration (dify/tools/base.py), the field is set to "dify" within the _build_automation_payload method. In the n8n integration (n8n/nodes/Tinyfish/GenericFunctions.ts), the field is set to "n8n" in the automation payload construction. These additions ensure that each integration identifies itself in the payload it generates.

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding api_integration tracking to both Dify and n8n integrations.
Description check ✅ Passed The description is well-related to the changeset, providing clear context about why the changes were made and what files were modified.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/track-integrations-origin
📝 Coding Plan
  • Generate coding plan for human review comments

Comment @coderabbitai help to get the list of available commands and usage tips.

@hwennnn hwennnn merged commit 289e26d into main Mar 12, 2026
3 checks passed
@hwennnn hwennnn deleted the feat/track-integrations-origin branch March 12, 2026 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants