intercom / intercom-node

Node.js bindings for the Intercom API
https://developers.intercom.com
Other
362 stars 116 forks source link

ERROR | Unexpected error when using the `search` query on the `post` method #402

Open Neosoulink opened 3 months ago

Neosoulink commented 3 months ago

Version info

Expected behavior

Being able to retrieve the expected ticket using the search query with the query field ticket_attribute.{id}

Actual behavior

After several attempts, I'm not able to search a ticket using the client.post method. For some reason, when passing the ticket_attribute. plus a specific attribute (even the default one), I'm getting an error.

Steps to reproduce

After the installation, token configuration, and environment settings completed

  1. Requesting the ticket
import { Operators } from "intercom-client";

const tickets = await intercomClient.post({
    url: `${env.INTERCOM_API_BASE_URL}/tickets/search`,
    data: {
      query: {
        field: "ticket_attribute.id", // The `id` is a custom attribute created in the workspace
        operator: Operators.EQUALS,
        value: ATTRIBUTE_ID_VALUE, // The `ATTRIBUTE_ID_VALUE` is a UUID string generated in a previous operation
      },
    },
  });

Logs

Error: The requested ticket attribute ID is not a valid integer

=====

[
  {
    code: 'field_not_found',
    message: 'The requested ticket attribute ID is not a valid integer'
  }
]

Resources: https://developers.intercom.com/docs/references/rest-api/api.intercom.io/Tickets/searchTickets/

ritmillio commented 2 months ago

Same issue here