Skip to content

feat: add groups API to SDK#20

Open
ferreiro wants to merge 2 commits intomainfrom
groups-api
Open

feat: add groups API to SDK#20
ferreiro wants to merge 2 commits intomainfrom
groups-api

Conversation

@ferreiro
Copy link
Copy Markdown
Contributor

@ferreiro ferreiro commented Dec 3, 2025

adding our new groups functionality that allows you to assign users to "groups", this is awesome for multi-tenant workspaces or "teams" to get insights at the "workspace" level


Note

Medium Risk
Introduces a new public SDK surface area and new endpoint wiring (including contact membership paths), which could cause breaking behavior if API paths/types are wrong; changes are otherwise additive and well-tested.

Overview
Adds a new Groups API client (smashsend.groups) with methods to create, list, get, update, and delete groups, plus endpoints to addContact, removeContact, and listContacts.

Exports new group-related TypeScript interfaces from index.ts and adds comprehensive Jest coverage for all group methods using a mocked HttpClient.

Also adds contacts.upsert() as a documented alias of contacts.create() for create-or-update-by-email flows.

Reviewed by Cursor Bugbot for commit 15af3d3. Bugbot is set up for automated code reviews on this repo. Configure here.

Adds an `upsert` method on the Contacts client as a semantic alias for
`create` — both hit POST /contacts, which is already an upsert by email
on the backend. The dedicated name makes it discoverable for signup
flows where callers don't have a contact ID yet.
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 15af3d3. Configure here.

Comment thread src/api/contacts.ts
*/
async upsert(options: ContactCreateOptions): Promise<Contact> {
return this.create(options);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Upsert method is identical to create, missing upsert behavior

High Severity

The upsert method is documented to "create or update a contact by email" if one already exists, but its implementation just delegates to this.create(options), which POSTs to /contacts — the exact same behavior as create. Since the codebase has a separate update method that PUTs to /contacts/{id}, the POST endpoint likely doesn't perform upsert logic. Users relying on upsert in signup flows would likely get duplicate-key errors for existing contacts instead of the documented update behavior.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 15af3d3. Configure here.

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.

1 participant