Skip to content

tickets/search API unable to retrieve tickets with a custom ticket_attribute set #139

Open

Description

@tommyhutcheson

tickets/search API unable to retrieve tickets with a custom ticket_attribute set

Hello

I am looking to use the tickets/search API to retrieve tickets with a particular ticket_attribute set.

This might already be possible but I am getting the syntax wrong, I can see on this page https://developers.intercom.com/docs/references/rest-api/api.intercom.io/Tickets/searchTickets/
it says you can use ticket_attribute.{id} as a field key but when I try this with a ticket attribute I am getting an error - field_not_found The request ticket attribute ID is not a valid integer response 400

Please advise on what I could be doing wrong here, thank you

Expected

import requests

url = https://api.intercom.io/tickets/search
 
payload = {
  "query": {

    "operator": "AND",

    "value": [

      {

        "field": "ticket_attribute.{my_ticket_attribute}",

        "operator": "=",

        "value": "Ready"

      },

      ]

   }

}


headers = {
  "Content-Type": "application/json",

  "Intercom-Version": "2.10",

  "Authorization": "Bearer <YOUR_TOKEN_HERE>"

}


response = requests.post(url, json=payload, headers=headers)


data = response.json()

print(data)

Reproduction Steps

Activity

  1. DanielFrydman commented on Dec 13, 2024

    @DanielFrydman

    @Eclairemoy any updates on this one?

  2. DanielFrydman commented on Dec 13, 2024

    @DanielFrydman

    @tommyhutcheson, I discovered how to search for specific attributes!

    Instead of using "ticket_attribute.{my_ticket_attribute}",
    use "ticket_attribute.123456" instead!

    How to find the ID for your attribute:

    1. Fetch a ticket.
    2. Look for the ticket_type_attribute object corresponding to your attribute.
    3. You’ll receive something like this:
    {
        "type": "ticket_type_attribute",
        "id": "123456",
        "workspace_id": "...",
        "name": "Your ticket attribute name",
        "description": null,
        "data_type": "string",
        "input_options": {
            "multiline": false
        },
        "order": 4,
        "required_to_create": false,
        "required_to_create_for_contacts": false,
        "visible_on_create": true,
        "visible_to_contacts": false,
        "default": false,
        "ticket_type_id": 1,
        "archived": false,
        "created_at": 1734009610,
        "updated_at": 1734009610
    }
    1. Grab the id field from this object.

    Example usage:

    {
        "field": "ticket_attribute.123456",
        "operator": "=",
        "value": "unknown"
    }

    Done!

    @Eclairemoy I think you can close this ticket!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions