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

Attach a tag to a contact #345

Open
baj84 opened this issue Aug 3, 2021 · 1 comment
Open

Attach a tag to a contact #345

baj84 opened this issue Aug 3, 2021 · 1 comment

Comments

@baj84
Copy link

baj84 commented Aug 3, 2021

Hi,

I'm trying to attach a tag to a contact. I can see it in the API docs, but I can find an appropriate method - has it been implemented?
https://developers.intercom.com/intercom-api-reference/reference#tag-contact

Thanks!

@dspachos
Copy link

I believe there is a method in intercom-php/src/IntercomTags.php:

    /**
     * Creates a Tag.
     *
     * @see    https://developers.intercom.io/reference#create-and-update-tags
     * @param  array $options
     * @return mixed
     * @throws \GuzzleHttp\Exception\GuzzleException
     */
    public function tag($options)
    {
        return $this->client->post("tags", $options);
    }

Now in v1.4 I can see that tags can be attached like this

<?php
# Note that you can use either id, user_id or email to tag a user.
# You only need to use one per user, e.g. the below will tag
# three users if each identifier is for a different, unique user
$intercom->tags->tag([
    "name" => "VIPs",
    "users" => [
        ["id" => "5977e20941abfc5aae4552d1"],
        ["user_id" => "12345"],
        ["email" => "camus@phil.com"]
    ]
]);
?>

but since I can't find something similar in latest 2.4. I dig a little in the documentation (p.s. I believe there are some issues with the latest documentation):

  • Here https://developers.intercom.com/intercom-api-reference/reference/create-and-update-tags there is no reference for a PHP method.

  • But in the https://developers.intercom.com/intercom-api-reference/reference/tag-companies there is a PHP example for untagging users (obviously, it's classified wrong ).,

Finally, looking at the README there is the

$client->tags->tag([
    'name' => 'Test',
    'users' => [
        ['id' => '1234'],
    ],
]);

Not sure if the above ^^ works though, but it's worth a try. Also, I can see that the method from 1.4 is still available, so if this doesn't work maybe try the first approach.

Hope it helps!

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

2 participants