Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const csv = 'Email,FirstName,LastName,Birthdate,PhoneNumber,City,Country,Gender,Platform,Stars,SUBSCRIBEDATE\n'
- Promise.all([
- this.hubspotClient.crm.imports.coreApi.create(JSON.stringify({
- name: 'anote_platform',
- files: [{
- fileName: 'platform.csv',
- fileFormat: 'CSV',
- dateFormat: 'DAY_MONTH_YEAR',
- fileImportPage: {
- hasHeader: true,
- columnMappings: [{
- columnName: 'Email',
- propertyName: 'email',
- columnObjectType: 'CONTACT',
- }, {
- columnName: 'Platform',
- propertyName: 'hs_content_membership_email_confirmed',
- columnObjectType: 'CONTACT',
- }, {
- columnName: 'FirstName',
- propertyName: 'firstname',
- columnObjectType: 'CONTACT',
- }]
- }
- }]
- }), {
- value: Buffer.from(csv),
- options: {
- filename: 'platform.csv',
- contentType: 'text/csv',
- },
- })
- ]).then(() => callback, e => {
- if(e.body) callback(JSON.stringify(e.body));
- else if(e.response) callback(JSON.stringify(e.response));
- else callback(e);
- });
Advertisement
Add Comment
Please, Sign In to add comment