Skip to content

Commit 7404e75

Browse files
committed
Now using CSVUrl from attachment
1 parent d4dd6a6 commit 7404e75

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

lib/read.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,16 @@ function processRead(msg, cfg) {
1414
var startRow = cfg.reader ? cfg.reader.startRow || 0 : 0;
1515

1616

17+
console.log('Incoming message is %j', msg);
1718
if (!csvURL || csvURL.length == 0) {
18-
console.error('URL of the CSV is missing');
19-
that.emit('error', 'URL of the CSV is missing');
20-
return that.emit('end');
19+
// Now let's check for the attachment
20+
if (msg && msg.attachments && msg.attachments.length > 0) {
21+
csvURL = msg.attachments[0].url
22+
} else {
23+
console.error('URL of the CSV is missing');
24+
that.emit('error', 'URL of the CSV is missing');
25+
return that.emit('end');
26+
}
2127
}
2228
var parser = csv.parse({delimiter: separator});
2329

0 commit comments

Comments
 (0)