Skip to content

Add EntityNote resource, contact task/note helpers and new contact/task filters - #161

Open
keith-chartmogul wants to merge 2 commits into
mainfrom
align_changes_to_contacts_tasks_notes_in_public_api
Open

keith-chartmogul wants to merge 2 commits into
mainfrom
align_changes_to_contacts_tasks_notes_in_public_api

Conversation

@keith-chartmogul

Copy link
Copy Markdown
Contributor

Aligns the SDK with recent changes to the public v1 API for Contacts, Tasks and Notes. All changes are additive; no existing method changes its behavior or endpoint.

Notes and call logs

  • New ChartMogul.EntityNote resource for /v1/notes, which supersedes /v1/customer_notes. Notes can be attached to a customer via customer_uuid or to a customer or contact via associated_object_identifier. Supports all, create, retrieve, patch and destroy, with customer_uuid, contact_uuid, type and author_email list filters.
  • ChartMogul.CustomerNote is deprecated. Its five methods still call /v1/customer_notes unchanged but now emit a [DEPRECATED] warning pointing at the EntityNote equivalent.
  • Customer.entityNotes and Customer.createEntityNote added; Customer.notes and Customer.createNote are deprecated with a warning.

Contacts

  • New helpers Contact.tasks, Contact.createTask, Contact.entityNotes and Contact.createEntityNote. The list helpers filter by contact_uuid. The create helpers attach the task or note to the contact via associated_object_identifier unless the caller supplies customer_uuid or their own identifier.
  • Contact.all documents the new email, customer_external_id and external_id filters. Contact.create no longer requires customer_uuid and data_source_uuid, and last_active_at / last_seen are covered by tests.

Tasks

  • Task.create accepts associated_object_identifier, with customer_uuid now optional.
  • Task.all documents the contact_uuid, assignee, due_date_on_or_after, due_date_on_or_before and completed filters. Tests confirm completed: false is serialized rather than dropped.

HTTP layer

  • Resource.request now resolves with {} on a 304 Not Modified response. The API returns this with an empty body when a PATCH to /v1/notes or /v1/tasks carries nothing to update; previously superagent surfaced it as an error.

Tests and docs

  • New test/chartmogul/entity-note.js suite; extended task, contact, customer, customer-note and resource suites, including assertions that the deprecation warnings fire and the legacy endpoints are still hit.
  • Task fixtures now use the API's task_uuid response key, and the contact create fixture uses customer_external_id with a 201.
  • README updated with a Notes and Call Logs section, a deprecated Customer Notes section, and the new contact and task filters and helpers.

No version bump in this PR; release via bin/release.sh minor after merge.

@keith-chartmogul
keith-chartmogul requested review from a team, loomchild, tudorpavel and ya-petrov-evgeniy and removed request for a team September 15, 2026 11:04
Comment thread lib/chartmogul/customer-note.js Outdated
CustomerNote[methodName] = function (...args) {
console.warn(`[DEPRECATED] CustomerNote.${methodName} is deprecated. Use ChartMogul.EntityNote.${methodName} instead.`);
return original.apply(this, args);
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[minor] Isn't this too smart - I'd repat the same thing like below for consistency.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call, I've replaced the loop with five explicit wrappers matching the Customer.notes / Subscription.all style 👍

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