{"command":{"effect":"write","timeoutSeconds":30,"inputSchema":{"type":"object","description":"You can search for multiple conversations by the value of their attributes in order to fetch exactly which ones you want.\n\nTo search for conversations, you need to send a `POST` request to `https://api.intercom.io/conversations/search`.\n\nThis will accept a query object in the body which will define your filters in order to search for conversations.\n{% admonition type=\"warning\" name=\"Optimizing search queries\" %}\n  Search queries can be complex, so optimizing them can help the performance of your search.\n  Use the `AND` and `OR` operators to combine multiple filters to get the exact results you need and utilize\n  pagination to limit the number of results returned. The default is `20` results per page and maximum is `150`.\n  See the [pagination section](https://developers.intercom.com/docs/build-an-integration/learn-more/rest-apis/pagination/#example-search-conversations-request) for more details on how to use the `starting_after` param.\n{% /admonition %}\n\n### Nesting & Limitations\n\nYou can nest these filters in order to get even more granular insights that pinpoint exactly what you need. Example: (1 OR 2) AND (3 OR 4).\nThere are some limitations to the amount of multiple's there can be:\n- There's a limit of max 2 nested filters\n- There's a limit of max 15 filters for each AND or OR group\n\n### Accepted Fields\n\nMost keys listed in the conversation model are searchable, whether writeable or not. The value you search for has to match the accepted type, otherwise the query will fail (ie. as `created_at` accepts a date, the `value` cannot be a string such as `\"foorbar\"`).\nThe `source.body` field is unique as the search will not be performed against the entire value, but instead against every element of the value separately. For example, when searching for a conversation with a `\"I need support\"` body - the query should contain a `=` operator with the value `\"support\"` for such conversation to be returned. A query with a `=` operator and a `\"need support\"` value will not yield a result.\n\n| Field                                     | Type                                                                                                                                                   |\n| :---------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------- |\n| id                                        | Integer                                                                                                                                                |\n| type                                      | String                                                                                                                                                 |\n| created_at                                | Date (UNIX timestamp)                                                                                                                                  |\n| updated_at                                | Date (UNIX timestamp)                                                                                                                                  |\n| source.type                               | String<br>Accepted fields are `conversation`, `email`, `facebook`, `instagram`, `phone_call`, `phone_switch`, `push`, `sms`, `twitter` and `whatsapp`. |\n| source.id                                 | Integer                                                                                                                                                |\n| source.delivered_as                       | String                                                                                                                                                 |\n| source.subject                            | String                                                                                                                                                 |\n| source.body                               | String                                                                                                                                                 |\n| source.author.id                          | String                                                                                                                                                 |\n| source.author.type                        | String                                                                                                                                                 |\n| source.author.name                        | String                                                                                                                                                 |\n| source.author.email                       | String                                                                                                                                                 |\n| source.url                                | String                                                                                                                                                 |\n| contact_ids                               | String                                                                                                                                                 |\n| teammate_ids                              | String                                                                                                                                                 |\n| admin_assignee_id                         | Integer                                                                                                                                                |\n| team_assignee_id                          | Integer                                                                                                                                                |\n| channel_initiated                         | String                                                                                                                                                 |\n| open                                      | Boolean                                                                                                                                                |\n| read                                      | Boolean                                                                                                                                                |\n| state                                     | String                                                                                                                                                 |\n| waiting_since                             | Date (UNIX timestamp)                                                                                                                                  |\n| snoozed_until                             | Date (UNIX timestamp)                                                                                                                                  |\n| tag_ids                                   | String                                                                                                                                                 |\n| priority                                  | String                                                                                                                                                 |\n| statistics.time_to_assignment             | Integer                                                                                                                                                |\n| statistics.time_to_admin_reply            | Integer                                                                                                                                                |\n| statistics.time_to_first_close            | Integer                                                                                                                                                |\n| statistics.time_to_last_close             | Integer                                                                                                                                                |\n| statistics.median_time_to_reply           | Integer                                                                                                                                                |\n| statistics.first_contact_reply_at         | Date (UNIX timestamp)                                                                                                                                  |\n| statistics.first_assignment_at            | Date (UNIX timestamp)                                                                                                                                  |\n| statistics.first_admin_reply_at           | Date (UNIX timestamp)                                                                                                                                  |\n| statistics.first_close_at                 | Date (UNIX timestamp)                                                                                                                                  |\n| statistics.last_assignment_at             | Date (UNIX timestamp)                                                                                                                                  |\n| statistics.last_assignment_admin_reply_at | Date (UNIX timestamp)                                                                                                                                  |\n| statistics.last_contact_reply_at          | Date (UNIX timestamp)                                                                                                                                  |\n| statistics.last_admin_reply_at            | Date (UNIX timestamp)                                                                                                                                  |\n| statistics.last_close_at                  | Date (UNIX timestamp)                                                                                                                                  |\n| statistics.last_closed_by_id              | Integer                                                                                                                                                |\n| statistics.count_reopens                  | Integer                                                                                                                                                |\n| statistics.count_assignments              | Integer                                                                                                                                                |\n| statistics.count_conversation_parts       | Integer                                                                                                                                                |\n| conversation_rating.requested_at          | Date (UNIX timestamp)                                                                                                                                  |\n| conversation_rating.replied_at            | Date (UNIX timestamp)                                                                                                                                  |\n| conversation_rating.score                 | Integer                                                                                                                                                |\n| conversation_rating.remark                | String                                                                                                                                                 |\n| conversation_rating.contact_id            | String                                                                                                                                                 |\n| conversation_rating.admin_id              | String                                                                                                                                                 |\n| ai_agent_participated                     | Boolean                                                                                                                                                |\n| ai_agent.resolution_state                 | String                                                                                                                                                 |\n| ai_agent.last_answer_type                 | String                                                                                                                                                 |\n| ai_agent.rating                           | Integer                                                                                                                                                |\n| ai_agent.rating_remark                    | String                                                                                                                                                 |\n| ai_agent.source_type                      | String                                                                                                                                                 |\n| ai_agent.source_title                     | String                                                                                                                                                 |\n\n### Accepted Operators\n\nThe table below shows the operators you can use to define how you want to search for the value.  The operator should be put in as a string (`\"=\"`). The operator has to be compatible with the field's type  (eg. you cannot search with `>` for a given string value as it's only compatible for integer's and dates).\n\n| Operator | Valid Types                    | Description                                                  |\n| :------- | :----------------------------- | :----------------------------------------------------------- |\n| =        | All                            | Equals                                                       |\n| !=       | All                            | Doesn't Equal                                                |\n| IN       | All                            | In  Shortcut for `OR` queries  Values most be in Array       |\n| NIN      | All                            | Not In  Shortcut for `OR !` queries  Values must be in Array |\n| >       | Integer  Date (UNIX Timestamp) | Greater than                                                 |\n| >=      | Integer  Date (UNIX Timestamp) | Greater than or equal to                                     |\n| <       | Integer  Date (UNIX Timestamp) | Lower than                                                   |\n| <=      | Integer  Date (UNIX Timestamp) | Lower than or equal to                                       |\n| ~        | String                         | Contains                                                     |\n| !~       | String                         | Doesn't Contain                                              |\n| ^        | String                         | Starts With                                                  |\n| $        | String                         | Ends With                                                    |\n### Sorting\n\nResults are sorted by `updated_at`, newest first. To sort differently, add a `sort` object to the request body with a `field` and an `order` of `ascending` or `descending`. `field` is required whenever `sort` is sent, and must be one of the fields in the table above, other than `type`, `state`, `source.subject`, `source.body`, `source.author.id`, `source.author.type`, `source.author.name`, `source.author.email`, `conversation_rating.remark`, `ai_agent.rating_remark` and `ai_agent.source_title`, which can't be sorted. A missing `field`, or one that isn't searchable, returns a `400` error with the code `invalid_field`.\n","properties":{"headers":{"type":"object","properties":{"Intercom-Version":{"$ref":"#/definitions/intercom_version","enum":["2.17"]}},"required":[],"additionalProperties":false},"query":{"type":"object","properties":{"include_monitors":{"type":"boolean","default":false,"examples":[true],"description":"If set to true, the response will include a `monitor_evaluations` array on each conversation with the latest QA monitor evaluation for each monitor that has evaluated it."},"include_scorecards":{"type":"boolean","default":false,"examples":[true],"description":"If set to true, the response will include a `scorecards` array on each conversation with any QA scorecard results."}},"required":[],"additionalProperties":false},"body":{"$ref":"#/definitions/search_request","examples":[{"query":{"operator":"AND","value":[{"field":"created_at","operator":">","value":"1306054154"}]},"pagination":{"per_page":5}}]}},"required":[],"additionalProperties":false,"definitions":{"intercom_version":{"description":"Intercom API version.</br>If you omit the header, the API uses the version set in your app package, and 1.0 if none is set.","type":"string","enum":["1.0","1.1","1.2","1.3","1.4","2.0","2.1","2.2","2.3","2.4","2.5","2.6","2.7","2.8","2.9","2.10","2.11","2.12","2.13","2.14","2.15","2.16","2.17"],"examples":["2.17"]},"search_request":{"description":"Search using Intercoms Search APIs.","type":"object","title":"Search data","properties":{"query":{"oneOf":[{"$ref":"#/definitions/single_filter_search_request"},{"$ref":"#/definitions/multiple_filter_search_request"}]},"pagination":{"$ref":"#/definitions/starting_after_paging"},"sort":{"type":"object","description":"How to sort the results. Without it, the endpoint's default order is used.","properties":{"field":{"type":"string","description":"The field to sort by, one of the searchable fields listed for the endpoint. Some fields can't be sorted; the endpoint's Sorting section says which. A missing `field`, or one that isn't searchable, returns a `400` error with the code `invalid_field`.","examples":["updated_at"]},"order":{"type":"string","enum":["ascending","descending"],"default":"descending","description":"The sort order.","examples":["descending"]}},"required":["field"]}},"required":["query"]},"single_filter_search_request":{"title":"Single Filter Search Request","description":"Search using Intercoms Search APIs with a single filter.","type":"object","properties":{"field":{"type":"string","description":"The accepted field that you want to search on.","examples":["created_at"]},"operator":{"type":"string","enum":["=","!=","IN","NIN","<","<=",">",">=","~","!~","^","$"],"description":"The accepted operators you can use to define how you want to search for the value. Operator support depends on the field's data type. The breakdown below is for Contacts search; the other search endpoints that share this schema accept a different set per field:\n- `string` fields: `=`, `!=`, `IN`, `NIN`, `~`, `!~`, `^`, `$`\n- `tag_id`: `=` and `!=` only. Every other operator returns an error.\n- `boolean` fields: `=`, `!=`, `IN`, `NIN`\n- `integer` fields: `=`, `!=`, `IN`, `NIN`, `<`, `>`, `<=`, `>=`\n- `datetime` fields (standard contact timestamps such as `created_at` and `last_seen_at`): `=`, `!=`, `<`, `>`, `<=`, `>=`. Filtering is on the exact second, in UTC.\n- `date` fields (Date custom attributes): `=`, `<`, `>` only. `!=`, `<=`, and `>=` are not supported and return an error. Values are truncated to a whole UTC day.","examples":[">"]},"value":{"oneOf":[{"type":"string"},{"type":"integer"},{"type":"boolean"},{"type":"array","items":{"oneOf":[{"type":"string"},{"type":"integer"}]}}],"description":"The value that you want to search on.","examples":["73732934"]}}},"multiple_filter_search_request":{"title":"Multiple Filter Search Request","description":"Search using Intercoms Search APIs with more than one filter.","type":"object","properties":{"operator":{"type":"string","enum":["AND","OR"],"description":"An operator to allow boolean inspection between multiple fields.","examples":["AND"]},"value":{"oneOf":[{"type":"array","description":"Add mutiple filters.","title":"multiple filter search request","items":{"$ref":"#/definitions/multiple_filter_search_request"}},{"type":"array","description":"Add a single filter field.","title":"single filter search request","items":{"$ref":"#/definitions/single_filter_search_request"}}]}}},"starting_after_paging":{"title":"Pagination: Starting After","type":["object","null"],"properties":{"per_page":{"type":"integer","description":"The number of results to fetch per page.","examples":[2]},"starting_after":{"type":["string","null"],"description":"The cursor to use in the next request to get the next page of results.","examples":["your-cursor-from-response"]}}}}},"name":"Search conversations","id":"intercom.searchconversations","example":{},"maxRequests":1,"summary":false}}