Add track_delivery_metric for /api/v1/metrics endpoint#139
Merged
Conversation
Adds support for reporting delivery metrics (opened, clicked, converted, delivered, bounced, deferred, dropped, spammed) via the new /api/v1/metrics endpoint, replacing the deprecated /push/events endpoint. Based on community PR #112 by @eserra with fixes for: - valid_url? bug that passed boolean instead of URL string - .present? usage (Rails-only, unavailable in plain Ruby) - Breaking constant renames (PUSH_* constants preserved) - Inconsistent attribute handling (now uses symbolize_keys/slice)
PUSH_OPENED/PUSH_CONVERTED/PUSH_DELIVERED were duplicates of DELIVERY_OPENED/DELIVERY_CONVERTED/DELIVERY_DELIVERED. Consolidate to a single set of constants.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 2fd7095. Configure here.
Preserves backwards compatibility for anyone referencing PUSH_OPENED, PUSH_CONVERTED, or PUSH_DELIVERED directly.
joeybaer
approved these changes
May 8, 2026
|
yeah! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
track_delivery_metricmethod toClientfor reporting delivery metrics via the/api/v1/metricsendpoint, replacing the deprecated/push/eventsendpointDELIVERY_*constants andVALID_DELIVERY_METRICStoCustomerio::ClientPUSH_OPENED,PUSH_CONVERTED,PUSH_DELIVEREDpreserved as deprecated aliases pointing toDELIVERY_*equivalentsBased on #112 by @eserra, reimplemented with fixes for:
valid_url?bug (passed boolean instead of URL string).present?usage (Rails-only, unavailable in plain Ruby)symbolize_keys/slicepattern)Test plan
track_delivery_metricsends correct POST to/api/v1/metricsNote
Low Risk
Mostly additive client API and tests; existing push-event constants are preserved as deprecated aliases and still map to the same metric strings, keeping compatibility risk low.
Overview
Adds
Client#track_delivery_metricto report delivery metrics to the new/api/v1/metricsendpoint, including input validation, attribute filtering, and support for optional fields (timestamp,recipient,reason,href).Introduces
DELIVERY_*constants plusVALID_DELIVERY_METRICS, deprecates the oldPUSH_*constants as aliases, and updates docs/changelog plus a comprehensive RSpec suite for the new endpoint. Also loosens RuboCopMetrics/ClassLengthto accommodate the added client code.Reviewed by Cursor Bugbot for commit a1aecda. Bugbot is set up for automated code reviews on this repo. Configure here.