instagram_connect 0.3.17 → 0.3.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -0
- data/lib/instagram_connect/client.rb +13 -2
- data/lib/instagram_connect/ingest/envelope.rb +16 -6
- data/lib/instagram_connect/usage.rb +4 -0
- data/lib/instagram_connect/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1a7dcce7b2dae41f81ed1e5d6f03a34a629c6e5ae90125bb673cb47eaea098f1
|
|
4
|
+
data.tar.gz: 8941b7ec8f788b2cd8e007282ba06d1a1480d2ed89bf2fd4f177e56aed384b1b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 779d9af0a92b505f7a93ca0b6502b8c82e6a4286782da41ddeb26f698a227e8107b56458d6a9a13bd504ff4d625a2a5414d062dfbec15f6b8eaeb33aeec794f3
|
|
7
|
+
data.tar.gz: 846973e8a0ed72106f650fa4342d493c15c4f5e4d79b87155c32a84e7545d96487403d5659d0587be3a4c7de2068089eb59afb3c8c003ac787746f8eac787c7a
|
data/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,23 @@ All notable changes to this project are documented here. The format follows
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.3.18] - 2026-07-28
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- **The comment-triggered DM (private reply) can carry quick replies.** It rides the full
|
|
14
|
+
messaging endpoint, so a funnel can open with buttons — titles clipped to Meta's 20 characters.
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
- **Comment webhooks no longer arrive stamped January 1970.** Meta sends messaging-webhook
|
|
19
|
+
timestamps in MILLISECONDS but comment/mention change webhooks in SECONDS; dividing everything
|
|
20
|
+
by 1000 collapsed every comment's clock to the epoch — which downstream read as "older than
|
|
21
|
+
Meta's 7-day reply window" and silently skipped every realtime comment automation.
|
|
22
|
+
`Envelope.time_from` now decides the unit by magnitude, so no caller has to know which field a
|
|
23
|
+
value came from.
|
|
24
|
+
|
|
25
|
+
|
|
9
26
|
## [0.3.17] - 2026-07-28
|
|
10
27
|
|
|
11
28
|
### Added
|
|
@@ -89,8 +89,19 @@ module InstagramConnect
|
|
|
89
89
|
end
|
|
90
90
|
|
|
91
91
|
# One-time private reply to a comment (comment -> DM), valid 7 days.
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
# The one DM a comment entitles us to send. It rides the full messaging
|
|
93
|
+
# endpoint (recipient by comment_id), so it can carry quick replies —
|
|
94
|
+
# which is how a comment-triggered funnel opens with buttons.
|
|
95
|
+
def private_reply(comment_id:, text:, quick_replies: nil)
|
|
96
|
+
message = { text: text }
|
|
97
|
+
if quick_replies.present?
|
|
98
|
+
message[:quick_replies] = Array(quick_replies).map do |reply|
|
|
99
|
+
{ content_type: "text",
|
|
100
|
+
title: reply[:title].to_s[0, 20],
|
|
101
|
+
payload: reply[:payload].to_s }
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
post("/me/messages", { recipient: { comment_id: comment_id }, message: message })
|
|
94
105
|
end
|
|
95
106
|
|
|
96
107
|
# --- Comments --------------------------------------------------------
|
|
@@ -11,13 +11,23 @@ module InstagramConnect
|
|
|
11
11
|
# storing it would corrupt every ordering that reads occurred_at.
|
|
12
12
|
MAX_SECONDS = 4_102_444_800 # 2100-01-01
|
|
13
13
|
|
|
14
|
-
#
|
|
15
|
-
#
|
|
16
|
-
#
|
|
17
|
-
|
|
18
|
-
return nil if millis.nil?
|
|
14
|
+
# Below this, a value can only be SECONDS since the epoch: the smallest
|
|
15
|
+
# millisecond timestamp Meta could send (year 2001+) is ~10^12, and a
|
|
16
|
+
# second-count will not reach 10^11 until the year 5138.
|
|
17
|
+
MILLIS_FLOOR = 100_000_000_000
|
|
19
18
|
|
|
20
|
-
|
|
19
|
+
# Meta is inconsistent on the wire: messaging webhooks stamp in
|
|
20
|
+
# MILLISECONDS, comment/mention change webhooks stamp entry.time in
|
|
21
|
+
# SECONDS. Dividing everything by 1000 turned every comment webhook's
|
|
22
|
+
# clock into January 1970 — which read as "older than Meta's 7-day
|
|
23
|
+
# reply window" and silently skipped every realtime comment automation.
|
|
24
|
+
# The magnitude decides the unit; no caller has to know which field it
|
|
25
|
+
# came from.
|
|
26
|
+
def self.time_from(value)
|
|
27
|
+
return nil if value.nil?
|
|
28
|
+
|
|
29
|
+
number = value.to_i
|
|
30
|
+
seconds = number >= MILLIS_FLOOR ? number / 1000.0 : number.to_f
|
|
21
31
|
return nil unless seconds.finite? && seconds >= 0 && seconds <= MAX_SECONDS
|
|
22
32
|
|
|
23
33
|
Time.at(seconds).utc
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
require "json"
|
|
2
2
|
|
|
3
|
+
# blank?/present? on plain objects — this file must not depend on which
|
|
4
|
+
# spec or host loaded ActiveSupport core extensions first.
|
|
5
|
+
require "active_support/core_ext/object/blank"
|
|
6
|
+
|
|
3
7
|
module InstagramConnect
|
|
4
8
|
# Meta's own account of how much of the rate budget a call just consumed,
|
|
5
9
|
# parsed from the response headers.
|