Answered

POST request for contact in company

  • 4 January 2022
  • 1 reply
  • 16 views

Hello, I need to send a POST request with the intercom API and I'm not sure how to do it. 

 

In particular, I need the contact id of the contact that has a specific company id (plus some other identifier that will help me pick the specific contact of the many that can exist in the company).

 

I'm using this: https://developers.intercom.com/intercom-api-reference/reference/search-for-contacts/p>

 

The question, therefore, is how do I do a POST query that queries not for a scalar as you would do to search eg for Minessota ("field": "location.region") but rather for a scalar within an array (as is the id within companies).

 

Here's a typical (truncate) response I need to process:

 

{

  "type": "list",

  "data": [

    {

      "type": "contact",

      "id": "60a3b30b980bf6b7f155eb99",

      "browser_language": "en",

      "os": "OS X 10.15.7",

      "location": {

        "type": "location",

        "country": "United States",

        "region": "Minnesota",

        "city": "Buffalo"

      },

      "android_app_name": null,

      "android_app_version": null,

        "companies": {

        "type": "list",

        "data": [

          {

            "id": "60a3baef1bffeb8a67d42b6a",

            "type": "company",

            "url": "/companies/60a3baef1bffeb8a67d42b6a"

          }

        ],

        "url": "/contacts/60a3b30b980bf6b7f155eb99/companies",

        "total_count": 1,

        "has_more": false

      },

      "opted_out_subscription_types": {

        "type": "list",

        "data": [],

        "url": "/contacts/60a3b30b980bf6b7f155eb99/subscriptions",

        "total_count": 0,

        "has_more": false

      }

    },

  ],

  "total_count": 1,

  "pages": {

    "type": "pages",

    "page": 1,

    "per_page": 50,

    "total_pages": 1

  }

}

 

 

Is this supported? If not, is there a workaround?

 

Thank you!

icon

Best answer by Aparna 6 January 2022, 12:41

View original

1 reply

Hey @dimitris a​ ! You can retrieve a contact or search for a contact or list contacts that are attached to a specific company. It is not possible to retrieve data of specific contacts that belong to specific companies. Nor there is any workaround.

Reply