Skip to content

Commit 176266c

Browse files
committed
Trying in platform
1 parent c95a635 commit 176266c

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lib/triggers/contacts.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const messages = require('elasticio-node').messages;
44
const co = require('co');
55
const MicrosoftGraph = require('msgraph-sdk-javascript');
66
const rp = require('request-promise');
7+
const _ = require('lodash');
78

89
/**
910
* This method will be called from elastic.io platform providing following data
@@ -56,10 +57,10 @@ function processAction(msg, cfg, snapshot) {
5657
const values = contacts.value;
5758
console.log('Found %s contacts', values.length);
5859
if (values.length > 0) {
59-
const message = messages.newMessageWithBody({
60-
contacts: values
61-
});
62-
this.emit('data', message);
60+
const messageBody = _.omitBy(contacts, (value, key) => key.startsWith('@odata.'));
61+
messageBody.calendarId = cfg.calendarId;
62+
console.log('MessageBody: ', messageBody);
63+
this.emit('data', messages.newMessageWithBody(messageBody));
6364
let lmdate = new Date(values[values.length - 1].lastModifiedDateTime);
6465
// The output value has always 0 milliseconds
6566
// we need to set the milliseconds value to 999 in order not to see

0 commit comments

Comments
 (0)