How to resolve author of type `bot`?

#1

When I fetch an Intercom conversation via REST API /conversations/{id} it returns an author of type bot for conversation parts posted by bots:

...
            {
                "type": "conversation_part",
                "id": "1676332104",
                "part_type": "comment",
                "body": "<p>Give them a way to reach you:</p>",
                "created_at": 1533900881,
                "updated_at": 1533900881,
                "notified_at": 1533900881,
                "assigned_to": null,
                "author": {
                    "type": "bot",
                    "id": "2298638"
                },
                "attachments": [],
                "external_id": null
            },
...

The bot has an id so that’s good, but how can I resolve it to something useful? Is there an API resource for this?

I tried no fetch the id via /users/{id} but that does not work.

0 Likes

#2

Ok, so just found out that you can call /admins/{id} resource with the bot id and it will return an admin-like value. Interestingly though, the REST API returns an object of type admin when the conversation endpoint has type bot.

{
    "type": "admin",
    "id": "2298638",
    "name": "Operator",
    "email": "operator+gb49kooj@intercom.io",
    "away_mode_enabled": false,
    "away_mode_reassign": false,
    "avatar": {
        "image_url": "https://static.intercomassets.com/assets/default-avatars/operator/128-10ee062f48e0940906c058aecb8a44c7a02acfc5e35d0fc9a30981611ace0c75.png"
    },
    "team_ids": [
        2298636
    ]
}

Would be good if the documentation could be updated with some details on this.

0 Likes

#3

Hey @tobi - indeed, it’s because you’ve hit the admins endpoint that the type shows as admin on the latter, but Operator is well and truly a bot. I’ll add a small callout to the documentation to flag that this is the case - nice digging yourself :+1:

1 Like