Exporting Articles from Intercom
Intercom is a conversational relationship platform that helps organizations provide better conversational and messenger-based experiences. It is a common tool used by many web platforms to enable live-communications with customers on their site. One of their offerings is a knowledge center that allows organizations to create a knowledge base and link that to the conversations; this prevents a 'live' rep from having to answer frequently asked questions.
Recently I had the task to help the marketing team to do an audit on all our content. As our content is constantly growing, there were a total of ~150 articles that needed to be audited. Intercom does not provide an easy way to export all the articles for offline viewing, so I had to write a small script to dump all the articles and provide them in CSV. This is that script
import requests
import pandas as pd
headers = {
'Authorization': 'Bearer <API Token>',
'Accept': 'application/json',
'Content-Type': 'application/json',
}
response = requests.get('https://api.intercom.io/articles?per_page=200', headers=headers).json() #Needed to avoid having to paginate
df = pd.DataFrame()
print("Total Articles: " + response['total_count'].str())
exit()
for data in response['data']:
entry = pd.DataFrame.from_dict(data=data)
df=df.append(entry)
df.to_csv('dict_file.csv', header=True)