Skip to content

Commit 2dff5e0

Browse files
committed
Fix event_type differentiation
1 parent bb14d93 commit 2dff5e0

File tree

6 files changed

+92
-72
lines changed

6 files changed

+92
-72
lines changed

app/models/webhooks/incoming/click_funnels_webhook.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def verify_authenticity
88
end
99

1010
def process
11-
event_type = data.dig("event_type_id")
11+
event_type = data.dig("event_type")
1212

1313
case event_type
1414
when "form_submission.created"

config/initializers/filter_parameter_logging.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
# Use this to limit dissemination of sensitive information.
55
# See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors.
66
Rails.application.config.filter_parameters += [
7-
:passw, :email, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn, :cvv, :cvc
7+
:passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn, :cvv, :cvc
88
]

test/controllers/webhooks/incoming/click_funnels_webhooks_controller_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def subscription_invoice_paid_payload
113113

114114
# Verify the webhook was created
115115
webhook = Webhooks::Incoming::ClickFunnelsWebhook.last
116-
assert_equal webhook.data["event_type_id"], "subscription.invoice.paid"
116+
assert_equal "subscription.invoice.paid", webhook.data["event_type"]
117117

118118
# Process the webhook (normally done asynchronously)
119119
webhook.process
Lines changed: 51 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,70 @@
11
{
2-
"id": 2,
3-
"public_id": "AdeHsX",
4-
"workspace_id": 42000,
5-
"uuid": "50b2c2631694e16e16d9e6b40ee066c0",
6-
"event_type_id": "contact.identified",
7-
"subject_id": 366,
8-
"subject_type": "Contact",
92
"data": {
10-
"id": 246579500,
11-
"tags": [],
12-
"uuid": "3783f37654f74bd2c088c2ffef1ce685",
3+
"id": 592504162,
4+
"tags": [
5+
],
6+
"uuid": "8001c567352f779c376049de87de16ce",
137
"fb_url": null,
8+
"visits": {
9+
"last_visit": null,
10+
"first_visit": {
11+
"id": 568536926,
12+
"ip": null,
13+
"os": null,
14+
"uuid": "f8aa1c45-dd29-4995-b9e5-d77689713b88",
15+
"browser": null,
16+
"referrer": null,
17+
"utm_term": null,
18+
"public_id": "aoZQLxD",
19+
"contact_id": 592504162,
20+
"created_at": "2025-06-03T03:38:34.150Z",
21+
"started_at": null,
22+
"updated_at": "2025-06-03T03:38:34.150Z",
23+
"user_agent": null,
24+
"utm_medium": null,
25+
"utm_source": null,
26+
"device_type": null,
27+
"utm_content": null,
28+
"landing_page": null,
29+
"utm_campaign": null,
30+
"referring_domain": null
31+
},
32+
"last_visit_with_utm": null
33+
},
1434
"anonymous": 0,
1535
"last_name": null,
16-
"public_id": "YYEXRWP",
17-
"time_zone": null,
18-
"created_at": "2024-04-24T09:23:56.649Z",
19-
"first_name": "Bobby",
20-
"updated_at": "2024-04-24T09:23:56.871Z",
36+
"public_id": "dZwLaGV",
37+
"time_zone": "Madrid",
38+
"created_at": "2025-06-03T03:38:33.919Z",
39+
"first_name": null,
40+
"updated_at": "2025-06-03T03:38:34.213Z",
2141
"twitter_url": null,
2242
"website_url": null,
2343
"linkedin_url": null,
2444
"phone_number": null,
25-
"workspace_id": 152039,
26-
"email_address": "bobby@fuzzy.com",
45+
"workspace_id": 365069,
46+
"email_address": "hey+localtest44@richsteinmetz.com",
2747
"instagram_url": null,
2848
"unsubscribed_at": null,
2949
"custom_attributes": {
30-
"preference": "always yes"
3150
},
3251
"last_notification_email_sent_at": null
3352
},
34-
"api_version": 2,
35-
"created_at": "2025-04-09T08:33:48.553Z",
3653
"page": {
37-
"id": 74,
38-
"public_id": "LnCjrR",
39-
"name": "Great Page"
54+
"id": 19448806,
55+
"name": "Copy of Optin -- 1b4c9",
56+
"public_id": "PLxnGE"
4057
},
4158
"funnel": {
42-
"id": 12,
43-
"public_id": "GVklHe",
44-
"name": "Example Funnel"
45-
}
59+
"id": 753114,
60+
"name": "Local Testing Funnels on Rails Funnel",
61+
"public_id": "jgPKGv"
62+
},
63+
"event_id": "86dd8628-03b8-41b0-a382-8b3a31d6e525",
64+
"created_at": "2025-06-03T03:38:34.042Z",
65+
"event_type": "contact.identified",
66+
"subject_id": 592504162,
67+
"api_version": 2,
68+
"subject_type": "Contact",
69+
"workspace_id": 365069
4670
}
Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,34 @@
11
{
2-
"id": 2,
3-
"public_id": "AdeHsX",
4-
"workspace_id": 42000,
5-
"uuid": "50b2c2631694e16e16d9e6b40ee066c0",
6-
"event_type_id": "form_submission.created",
7-
"subject_id": 366,
8-
"subject_type": "FormSubmission",
92
"data": {
10-
"id": 39586672,
11-
"public_id": "rkvlrx",
12-
"contact_id": 571635165,
13-
"workspace_id": 365069,
14-
"page_id": 18975930,
15-
"created_at": "2025-05-13T15:52:39.761Z",
16-
"updated_at": "2025-05-13T15:52:39.792Z",
3+
"id": 41369475,
174
"data": {
185
"contact": {
19-
"email": "barba@rando.com"
6+
"email": "sssss@asfas.com"
207
},
21-
"ip_address": "192.145.38.105"
22-
}
8+
"ip_address": "80.169.85.234"
9+
},
10+
"page_id": 19448806,
11+
"public_id": "DlopZq",
12+
"contact_id": 597102013,
13+
"created_at": "2025-06-07T15:36:08.474Z",
14+
"updated_at": "2025-06-07T15:36:08.500Z",
15+
"workspace_id": 365069
2316
},
24-
"api_version": 2,
25-
"created_at": "2025-04-09T08:33:48.553Z",
2617
"page": {
27-
"id": 74,
28-
"public_id": "LnCjrR",
29-
"name": "Great Page"
18+
"id": 19448806,
19+
"name": "Copy of Optin -- 1b4c9",
20+
"public_id": "PLxnGE"
3021
},
3122
"funnel": {
32-
"id": 12,
33-
"public_id": "GVklHe",
34-
"name": "Example Funnel"
35-
}
23+
"id": 753114,
24+
"name": "Local Testing Funnels on Rails Funnel",
25+
"public_id": "jgPKGv"
26+
},
27+
"event_id": "35da3f53-715c-4c13-a957-f6931d63c4c7",
28+
"created_at": "2025-06-07T15:36:08.507Z",
29+
"event_type": "form_submission.created",
30+
"subject_id": 41369475,
31+
"api_version": 2,
32+
"subject_type": "FormSubmission",
33+
"workspace_id": 365069
3634
}

test/fixtures/webhooks/incoming/click_funnels/subscription_invoice_paid_payload.json

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
11
{
2-
"id": 2,
3-
"public_id": "AdeHsX",
4-
"workspace_id": 42000,
5-
"uuid": "50b2c2631694e16e16d9e6b40ee066c0",
6-
"event_type_id": "subscription.invoice.paid",
7-
"subject_id": 366,
8-
"subject_type": "Orders::Invoice",
92
"data": {
103
"id": 5750950,
114
"public_id": "EYXXEz",
@@ -202,16 +195,21 @@
202195
"last_visit_with_utm": null
203196
}
204197
},
205-
"api_version": 2,
206-
"created_at": "2025-04-09T08:33:48.553Z",
207198
"page": {
208-
"id": 74,
209-
"public_id": "LnCjrR",
210-
"name": "Great Page"
199+
"id": 19448806,
200+
"name": "Copy of Optin -- 1b4c9",
201+
"public_id": "PLxnGE"
211202
},
212203
"funnel": {
213-
"id": 12,
214-
"public_id": "GVklHe",
215-
"name": "Example Funnel"
216-
}
204+
"id": 753114,
205+
"name": "Local Testing Funnels on Rails Funnel",
206+
"public_id": "jgPKGv"
207+
},
208+
"event_id": "86dd8628-03b8-41b0-a382-8b3a31d6e525",
209+
"created_at": "2025-06-03T03:38:34.042Z",
210+
"event_type": "subscription.invoice.paid",
211+
"subject_id": 592504162,
212+
"api_version": 2,
213+
"subject_type": "Orders::Invoice",
214+
"workspace_id": 365069
217215
}

0 commit comments

Comments
 (0)