I'm trying to access intercom API and create a company there using their API https://developers.intercom.com/intercom-api-reference/reference#create-or-update-company but getting CORS error!
URL = 'https://api.intercom.io/companies'
this.httpOptions = {
headers: new HttpHeaders({
'Content-Type': 'application/json',
'Authorization': 'Bearer ....',
'Access-Control-Allow-Origin': '*'
})
};
const path = this.URL + '/companies';
return this.http.post(path, data, {headers: this.httpOptions});
How to fix CORS error?
Intercome apis doest not work in the client side. You need use server side package to make api call on intercome.
You can use one of them:
1- Nodejs http client package : axios
2- Official node package : intercom-node