Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tagging API seems odd, or maybe needs more documentation #307

Open
stickfigure opened this issue Mar 5, 2023 · 2 comments
Open

Tagging API seems odd, or maybe needs more documentation #307

stickfigure opened this issue Mar 5, 2023 · 2 comments

Comments

@stickfigure
Copy link

  • intercom-java version: 2.8.2

The README documentation shows how to create a Tag and use it to tag users. However, the vast majority of time, an existing tag will be used. It's not obvious from the documentation how we're supposed to use a tag without creating one.

We can obtain a Tag object by iterating all of the tags. This seems slow and expensive.

There's new Tag().setName() but there's no way to set the id. Is the id necessary for tagging users and companies? It doesn't seem to be in the underlying rest api, but the Java code seems to use it.

Would love some clarification. Thanks.

@stickfigure
Copy link
Author

To add some experimental results:

It appears that new Tag().setName() is enough to create a tag for tagging, though there's a really weird problem. If you want to untag, you set untag() on the company/user that you pass into the Tag.tag(tag, company). But this creates a one-way mutation of the Company/User. If I want to perform a series of tags/untags, I have to construct a new Company for each one.

I guess it works, but it's a bit clunky.

@stickfigure
Copy link
Author

To illustrate, this appears to be the code necessary:

	public static void tag(final String companyId, final String tagName, final boolean present) {
		final Company company = new Company().setCompanyID(companyId);

		if (!present) {
			company.untag();
		}

		final Tag tag = new Tag().setName(tagName);
		Tag.tag(tag, company);
	}

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

No branches or pull requests

1 participant