Hi,
I’ve been trying to pull out data from the message export model, as detailed here: https://developers.intercom.com/intercom-api-reference/v0/reference#export-job-model
Everything here “works” in the sense that there are no errors, and I get 200 http response codes, but when it comes to downloading the data at the end, there doesn’t appear to be any!
The app I’m making this for is Python-based, but using curl directly gives the same results:
---
First, set up an export job (in this case exporting the last 10 days of messages):
curl https://api.intercom.io/export/messages/data -X POST -H ‘Authorization:Bearer <token>’ -H “Intercom-Version: Unstable” -H ‘Accept: application/json’ -H ‘Content-Type: application/json’ -d ‘{“created_at_after”: 1603407600, “created_at_before”: 1604275200}’
As expected, this gives a response like
{“job_identifier”:<job-id>,“status”:“pending”,“download_url”:“”,“download_expires_at”:“”}
---
Secondly, check status:
curl https://api.intercom.io/export/messages/data/<job-id> -X GET -H ‘Authorization:Bearer <token>’ -H “Intercom-Version: Unstable” -H ‘Accept: application/json’
which gives a response like
{“job_identifier”:<job-id>,“status”:“complete”,“download_url”:“https://api.intercom.io/download/messages/data/message-data-export.no-data-timeframe”,“download_expires_at”:<timestamp>}
---
Finally, pinging the download_url above (and just telling it to dump any raw data in console to see if there’s anything):
curl https://api.intercom.io/download/messages/data/message-data-export.no-data-timeframe -X GET -H ‘Authorization:Bearer <token>’ -H “Intercom-Version: Unstable” -H ‘Accept: application/octet-stream’ --output -
But when I do this, nothing appears. Similar story in the Python environment - specifically on the final step I have a requests response object, but looking at its content (response.content) just returns an empty bytes object (b’’).
---
Unless I’m being horribly misled we should have message data available - according to the reports in the customer engagement UI, we send a few hundred each day.
The two question marks I have right now are:
- The default API version is 2.2 (I think) - passing “Intercom-Version: Unstable” in the request headers seems to work, but maybe things are more nuanced than that?
- The url returned to download data from seems suspiciously generic: https://api.intercom.io/download/messages/data/message-data-export.no-data-timeframe - the no-data-timeframe seems to imply that the time bounds aren’t being picked up properly, but that’s confusing considering I do send them, and get an error if I don’t anyway.
Any pointers in solving this very appreciated!