Comments (9)
Ok, this has been a big time misunderstanding: The fact that links.error
is present, does not mean that an error occurred. Instead, this is just a pointer to any possible errors. The job gets queued on Intercom side and has the state
of running
– for hours or even days. In case an error happened, the url will have the full error available. One just has to perform another request to fetch the list of errors, again with an Accept
header of application/json
like the rest of the API. The endpoint is not meant to be accessible via a browser. One can try Postman or similar applications to retrieve that data. Or poll the Intercom servers for the state
of a job over a longer period and in case it failed, fetch the result and save it somewhere for inspection.
from intercom-node.
@franz-josef-kaiser This appears to be that you're receiving the correct job model response, but when you try to access the error URL, you are not passing the 'Accept' header, so it is returning that response. Try accessing the error URL and passing the correct 'Accept' header with it. Does that help?
from intercom-node.
Yes! Got it. I ran this and got much more information on the job about errors or if the bulg job was done curl -u 'app_id':'app_api_key' -H 'Content-Type: application/json' -H 'Accept: application/json' https://api.intercom.io/jobs/job_8de063a0_43cb_11e6_a749_11589fe21ce7
from intercom-node.
Update: I tried to switch away from your client and use the widely spread request
package. The result is the same:
return request.post( {
uri : 'https://api.intercom.io/bulk/users',
'auth': {
'user' : process.env.INTERCOM_APP_ID,
'pass' : process.env.INTERCOM_APP_ID_KEY,
'sendImmediately' : false
},
headers : {
'Accept' : 'application/json',
'Content-Type' : 'application/json'
},
body : { items : members },
json : true,
transform : function( body, response, resolveWithFullResponse ) {
console.info( '[intercom] [INFO] [Setup: transform]',
JSON.stringify( body )
);
return body;
}
} )
.then( function( response ) {
console.info( '[intercom] [INFO] [Setup: response]', response );
} )
The transform
closure log gives the following output:
[intercom] [INFO] [Setup: transform]
{
"app_id": "xxxxx",
"id": "job_xxx",
"created_at": 1464183095,
"completed_at": null,
"closing_at": 1464183995,
"updated_at": 1464183095,
"name": "api_bulk_job",
"state": "running",
"links": {
"error": "https://api.intercom.io/jobs/job_xxx/error",
"self": "https://api.intercom.io/jobs/job_xxx"
}
}
The actual response is the following:
[intercom] [INFO] [Setup: response]
{
app_id : 'xxxxx',
id : 'job_xxx',
created_at : 1464183095,
completed_at : null,
closing_at : 1464183995,
updated_at : 1464183095,
name : 'api_bulk_job',
state : 'running',
links : {
error : 'https://api.intercom.io/jobs/job_xxx/error',
self : 'https://api.intercom.io/jobs/job_xxx'
}
}
Where the links.error
is above posted error in logs
with media_type_not_acceptable
.
from intercom-node.
@edkellena As you can see from above plain request using the npm request
package, I set the correct Accept
header…
from intercom-node.
I believe I am having the same issue, using the node intercom client
headers:
{ 'Content-Type': 'application/json',
Accept: 'application/json',
'User-Agent': 'intercom-node-client/2.0.0',
authorization: 'Basic bmkxbmN6ZG46MmQ1YmQ3MzM5NjkyOWI5YWFlNzUxZjJlOGI3NDc5MGYwOWU1ZWVhNA==',
'content-length': 3057 },
from intercom-node.
@coopernewby Have you read my last comment? Job queue and such?
P.s.: Can you please use code formatting? Makes it much easier to read.
from intercom-node.
Yes sorry about the formatting. I just don't understand how long the bulk jobs seem to run for or how to fix the 'media_type_not_acceptable' error. This is what I am passing in:
bulkUsers.push({ create: { email: output[j][0], user_id: output[j][4], type: output[j][9], name: output[j][2], companies: [{ id: output[j][6] }] } })
from intercom-node.
Are you looking at the request in a browser? Use something like the Postman app instead.
from intercom-node.
Related Issues (20)
- Unable to pass customAttribute object to client.conversation.update() HOT 1
- Typo in type `RecepientType` (should be RecipientType) HOT 2
- I can not create a contact user. HOT 8
- Try to run boiler plate code in a node script either results in "SyntaxError: Cannot use import statement outside a module" or "Error [ERR_MODULE_NOT_FOUND]" HOT 1
- Unable to update by companyId with `client.companies.update`
- Type issue while using Intercom-Version headers HOT 1
- Small mistake in README - "import { Client } from './dist/index';" HOT 1
- Get Converting circular structure to JSON error when init Client
- How to import types ? HOT 1
- Unexpected behaviour using access token HOT 2
- Creating and Updating a Company - only companyId should be required
- Searching conversations with date fields always returns an empty result
- Do not throw undefined when the response body does not match the intercom API format
- Axios dependency version has critical vulnerability CVE-2023-45857 HOT 2
- createDataAttribute returns a 500
- ERROR | Unexpected error when using the `search` query on the `post` method HOT 1
- Intercom migration guide is missing
- #2
- Unable to build 5.0.0 with TypeScript
- `listAttachedTags` Method has wrong return type
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from intercom-node.