intercom / intercom-dotnet

Intercom API client library for .NET
https://developers.intercom.io/reference
Apache License 2.0
63 stars 54 forks source link

Unable to create a company in Intercom #158

Closed DavidKlempfner closed 4 years ago

DavidKlempfner commented 4 years ago

I'm using this code:

Authentication authentication = new Authentication("myAccessToken");
RestClientFactory restClientFactory = new RestClientFactory(authentication);
var _companyClient = new CompanyClient(restClientFactory);

var companyCustomAttributes = new Dictionary<string, object>()
            {
                { "name", "TradingName" },
                { "company_id_str", "5432" },
                { "isoCode", "AU" },
                { "regionCode", "VIC" },
                { "isPropertyManagement", false },
                { "isSales", false },
                { "setupComplete", false },
                { "isSubscription", false },
                { "subscriptionSetupComplete", false },
                { "tradingName", "TradingName" },
                { "ofSMS", false },
                { "ofBankTransfer", false },
                { "ofCommercial", false },
                { "isEmailValidated", true },
                { "isLocked", false },
                { "isOutgoingEmailValidated", true },
                { "banks", "" },
                { "earlyAdopterProgram", false },
                { "propertyCount", 0 }
            };

var company = new Company();
company.company_id = "5432";
company.custom_attributes = companyCustomAttributes;

var createdCompany = _companyClient.Create(company);

The createdCompanyis not null:

image

But the company is not showing in the UI:

image

Why is the company not showing in the UI?

Intercom API version = 1.4

Intercom.Dotnet.Client version = 2.1.1

StackOverflow question: https://stackoverflow.com/questions/58967672/unable-to-create-a-company-in-intercom

DavidKlempfner commented 4 years ago

Looks like this is by design. Apparently companies don't show up if they have no users: https://github.com/intercom/intercom-java/issues/7

Really wish this was fixed so I didn't waste hours trying to work out what's going on.

lloydliyu commented 4 years ago

Hey @DavidKlempfner, that is right - this is by design. A company must have at least one user to be visible within the UI. If you have any further questions on this, or want to log a feature request, I'd recommend reaching out to the support team using the Messenger on https://intercom.com.

Closing this out as this is more to do with how the Intercom Web UI works, rather than the SDK.

bledari commented 3 years ago

Hi I have some issues. I was trying to create companies through Postman and it didn't work, then with curl code it worked! I can retrieve companies by id and understand the list of companies displays only those with user. Now users I see are contacts. I was able to associate a contact to a company (difficult because doc has error, mark it as a POST) but still nothing in list companies.

You can try to reproduce this or just pass me some working Postman collection and I figure out why

I believe it is a design flow not to give the entire list of companies one created previously just as with other objects. If you want to return companies with users only, fine, but you should put that in another endpoint or make listCompanies accept filters/params

lloydliyu commented 3 years ago

Hey @bledari :wave:

The Intercom support team would be best placed to assist you with using our API. They can be contacted using Messenger on https://intercom.com. This repo refers only to usage of the .Net SDK and bug reports for that SDK.