@meltwater/conversations-api-services 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meltwater/conversations-api-services",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Repository to contain all conversations api services shared across our services",
5
5
  "type": "module",
6
6
  "main": "src/data-access/index.js",
@@ -1,5 +1,5 @@
1
- import superagentfrom from 'superagent';
2
- import configurationfrom from '../../lib/configuration.js';
1
+ import superagent from 'superagent';
2
+ import configuration from '../../lib/configuration.js';
3
3
  // import { DOCUMENT_STATUS } from '@data-access/mongo/query.helpers.js';
4
4
  // import { messagesRepository } from '@data-access/mongo/repository/messages.js';
5
5
  // import PushRepositoryfrom from '@data-access/redis/repository/push.repository.js';
@@ -104,21 +104,27 @@ export class LinkedInApiClient {
104
104
  },
105
105
  metaData: {
106
106
  externalId,
107
- inReplyTo: { id: inReplyToId},
107
+ source: { id: actorURN },
108
+ inReplyTo: { id: inReplyToId },
108
109
  },
109
110
  } = document;
110
111
 
112
+ const [, comment] = externalId.split(',');
113
+ const commentId = comment.split(')')[0];
114
+
111
115
  let response;
112
116
  let query = `${configuration.get(
113
- 'LINKEDIN_API'
114
- )}/socialActions/${fixedEncodeURIComponent(inReplyToId)}/comments/${fixedEncodeURIComponent(externalId)}`;
117
+ 'LINKEDIN_API'
118
+ )}/socialActions/${fixedEncodeURIComponent(
119
+ inReplyToId
120
+ )}/comments/${commentId}?actor=${fixedEncodeURIComponent(actorURN)}`;
115
121
 
116
122
  try {
117
123
  let credential = await this.tokenService.getByCredentialId(
118
124
  credentialId,
119
125
  companyId
120
126
  );
121
-
127
+
122
128
  this.logger.debug(`${documentId} - trying Delete `, {
123
129
  query,
124
130
  });
@@ -130,7 +136,7 @@ export class LinkedInApiClient {
130
136
  'X-RestLi-Protocol-Version': configuration.get(
131
137
  'LINKEDIN_API_VERSION'
132
138
  ),
133
- 'LinkedIn-Version': '202401',
139
+ 'LinkedIn-Version': '202305',
134
140
  });
135
141
 
136
142
  this.logger.info(