@meltwater/conversations-api-services 1.1.15 → 1.1.16

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.
@@ -32,7 +32,7 @@ async function like(token, externalId, socialAccountId, logger) {
32
32
  actor: socialAccountId,
33
33
  object: externalId
34
34
  };
35
- let query = `${LINKEDIN_API}/socialActions/${fixedEncodeURIComponent(externalId)}/likes`;
35
+ let query = `${LINKEDIN_API_REST}/socialActions/${fixedEncodeURIComponent(externalId)}/likes`;
36
36
  try {
37
37
  (0, _loggerHelpers.loggerDebug)(logger, `Linkedin trying to Like `, {
38
38
  query,
@@ -59,7 +59,7 @@ async function unlike(token, externalId, socialAccountId, logger) {
59
59
  actor: socialAccountId,
60
60
  object: externalId
61
61
  };
62
- let query = `${LINKEDIN_API}/socialActions/${fixedEncodeURIComponent(externalId)}/likes/${fixedEncodeURIComponent(payload.actor)}?actor=${fixedEncodeURIComponent(payload.actor)}`;
62
+ let query = `${LINKEDIN_API_REST}/socialActions/${fixedEncodeURIComponent(externalId)}/likes/${fixedEncodeURIComponent(payload.actor)}?actor=${fixedEncodeURIComponent(payload.actor)}`;
63
63
  try {
64
64
  (0, _loggerHelpers.loggerDebug)(logger, `Linkedin trying Delete Previous Like `, {
65
65
  query,
@@ -83,7 +83,7 @@ async function deleteMessage(token, externalId, sourceId, inReplyToId, logger) {
83
83
  const [, comment] = externalId.split(',');
84
84
  const commentId = comment.split(')')[0];
85
85
  let response;
86
- const query = `${LINKEDIN_API}/socialActions/${fixedEncodeURIComponent(inReplyToId)}/comments/${commentId}?actor=${fixedEncodeURIComponent(sourceId)}`;
86
+ const query = `${LINKEDIN_API_REST}/socialActions/${fixedEncodeURIComponent(inReplyToId)}/comments/${commentId}?actor=${fixedEncodeURIComponent(sourceId)}`;
87
87
  try {
88
88
  (0, _loggerHelpers.loggerDebug)(logger, `Linkedin trying Delete `, {
89
89
  query
@@ -182,6 +182,8 @@ async function publish(token, discussionType, mediaId, inReplyToId, socialAccoun
182
182
  }
183
183
  let body = {
184
184
  actor: socialAccountId,
185
+ object: inReplyToId,
186
+ // Required field for REST API
185
187
  message: {
186
188
  attributes: attributes,
187
189
  text: textWithoutMentions || '' // Replace mention spans with the mention text
@@ -198,7 +200,7 @@ async function publish(token, discussionType, mediaId, inReplyToId, socialAccoun
198
200
  type: 'IMAGE'
199
201
  }];
200
202
  }
201
- let query = `${LINKEDIN_API}/socialActions/${fixedEncodeURIComponent(inReplyToId)}/comments`;
203
+ let query = `${LINKEDIN_API_REST}/socialActions/${fixedEncodeURIComponent(inReplyToId)}/comments`;
202
204
 
203
205
  // data-listener -> linkedin_api.client sendComment
204
206
  let response;
@@ -474,7 +476,7 @@ async function getSocialStats(externalId, token, logger) {
474
476
  async function likedByUser(token, externalId, authorExternalId, logger) {
475
477
  let result;
476
478
  try {
477
- result = await _superagent.default.get(`${LINKEDIN_API}/reactions/(actor:${fixedEncodeURIComponent(authorExternalId)},entity:${fixedEncodeURIComponent(externalId)})`).set({
479
+ result = await _superagent.default.get(`${LINKEDIN_API_REST}/reactions/(actor:${fixedEncodeURIComponent(authorExternalId)},entity:${fixedEncodeURIComponent(externalId)})`).set({
478
480
  Authorization: `Bearer ${token}`,
479
481
  'X-RestLi-Protocol-Version': LINKEDIN_API_VERSION,
480
482
  'LinkedIn-Version': LINKEDIN_VERSION
@@ -10,7 +10,7 @@ export async function like(token, externalId, socialAccountId, logger) {
10
10
  actor: socialAccountId,
11
11
  object: externalId
12
12
  };
13
- let query = `${LINKEDIN_API}/socialActions/${fixedEncodeURIComponent(externalId)}/likes`;
13
+ let query = `${LINKEDIN_API_REST}/socialActions/${fixedEncodeURIComponent(externalId)}/likes`;
14
14
  try {
15
15
  loggerDebug(logger, `Linkedin trying to Like `, {
16
16
  query,
@@ -37,7 +37,7 @@ export async function unlike(token, externalId, socialAccountId, logger) {
37
37
  actor: socialAccountId,
38
38
  object: externalId
39
39
  };
40
- let query = `${LINKEDIN_API}/socialActions/${fixedEncodeURIComponent(externalId)}/likes/${fixedEncodeURIComponent(payload.actor)}?actor=${fixedEncodeURIComponent(payload.actor)}`;
40
+ let query = `${LINKEDIN_API_REST}/socialActions/${fixedEncodeURIComponent(externalId)}/likes/${fixedEncodeURIComponent(payload.actor)}?actor=${fixedEncodeURIComponent(payload.actor)}`;
41
41
  try {
42
42
  loggerDebug(logger, `Linkedin trying Delete Previous Like `, {
43
43
  query,
@@ -61,7 +61,7 @@ export async function deleteMessage(token, externalId, sourceId, inReplyToId, lo
61
61
  const [, comment] = externalId.split(',');
62
62
  const commentId = comment.split(')')[0];
63
63
  let response;
64
- const query = `${LINKEDIN_API}/socialActions/${fixedEncodeURIComponent(inReplyToId)}/comments/${commentId}?actor=${fixedEncodeURIComponent(sourceId)}`;
64
+ const query = `${LINKEDIN_API_REST}/socialActions/${fixedEncodeURIComponent(inReplyToId)}/comments/${commentId}?actor=${fixedEncodeURIComponent(sourceId)}`;
65
65
  try {
66
66
  loggerDebug(logger, `Linkedin trying Delete `, {
67
67
  query
@@ -160,6 +160,8 @@ async function publish(token, discussionType, mediaId, inReplyToId, socialAccoun
160
160
  }
161
161
  let body = {
162
162
  actor: socialAccountId,
163
+ object: inReplyToId,
164
+ // Required field for REST API
163
165
  message: {
164
166
  attributes: attributes,
165
167
  text: textWithoutMentions || '' // Replace mention spans with the mention text
@@ -176,7 +178,7 @@ async function publish(token, discussionType, mediaId, inReplyToId, socialAccoun
176
178
  type: 'IMAGE'
177
179
  }];
178
180
  }
179
- let query = `${LINKEDIN_API}/socialActions/${fixedEncodeURIComponent(inReplyToId)}/comments`;
181
+ let query = `${LINKEDIN_API_REST}/socialActions/${fixedEncodeURIComponent(inReplyToId)}/comments`;
180
182
 
181
183
  // data-listener -> linkedin_api.client sendComment
182
184
  let response;
@@ -452,7 +454,7 @@ export async function getSocialStats(externalId, token, logger) {
452
454
  export async function likedByUser(token, externalId, authorExternalId, logger) {
453
455
  let result;
454
456
  try {
455
- result = await superagent.get(`${LINKEDIN_API}/reactions/(actor:${fixedEncodeURIComponent(authorExternalId)},entity:${fixedEncodeURIComponent(externalId)})`).set({
457
+ result = await superagent.get(`${LINKEDIN_API_REST}/reactions/(actor:${fixedEncodeURIComponent(authorExternalId)},entity:${fixedEncodeURIComponent(externalId)})`).set({
456
458
  Authorization: `Bearer ${token}`,
457
459
  'X-RestLi-Protocol-Version': LINKEDIN_API_VERSION,
458
460
  'LinkedIn-Version': LINKEDIN_VERSION
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meltwater/conversations-api-services",
3
- "version": "1.1.15",
3
+ "version": "1.1.16",
4
4
  "description": "Repository to contain all conversations api services shared across our services",
5
5
  "main": "dist/cjs/data-access/index.js",
6
6
  "module": "dist/esm/data-access/index.js",
@@ -10,7 +10,7 @@ const LINKEDIN_VERSION = "202411";
10
10
  export async function like(token, externalId, socialAccountId, logger) {
11
11
  let response;
12
12
  let payload = { actor: socialAccountId, object: externalId };
13
- let query = `${LINKEDIN_API}/socialActions/${fixedEncodeURIComponent(externalId)}/likes`
13
+ let query = `${LINKEDIN_API_REST}/socialActions/${fixedEncodeURIComponent(externalId)}/likes`
14
14
 
15
15
  try {
16
16
  loggerDebug(logger,`Linkedin trying to Like `, {
@@ -42,7 +42,7 @@ export async function like(token, externalId, socialAccountId, logger) {
42
42
  export async function unlike(token, externalId, socialAccountId, logger) {
43
43
  let response;
44
44
  let payload = { actor: socialAccountId, object: externalId };
45
- let query = `${LINKEDIN_API}/socialActions/${fixedEncodeURIComponent(
45
+ let query = `${LINKEDIN_API_REST}/socialActions/${fixedEncodeURIComponent(
46
46
  externalId
47
47
  )}/likes/${fixedEncodeURIComponent(
48
48
  payload.actor
@@ -78,7 +78,7 @@ export async function deleteMessage(token, externalId, sourceId, inReplyToId, lo
78
78
  const commentId = comment.split(')')[0];
79
79
 
80
80
  let response;
81
- const query = `${LINKEDIN_API}/socialActions/${fixedEncodeURIComponent(
81
+ const query = `${LINKEDIN_API_REST}/socialActions/${fixedEncodeURIComponent(
82
82
  inReplyToId
83
83
  )}/comments/${commentId}?actor=${fixedEncodeURIComponent(sourceId)}`;
84
84
 
@@ -207,6 +207,7 @@ async function publish(token,discussionType, mediaId,inReplyToId,socialAccountId
207
207
 
208
208
  let body = {
209
209
  actor: socialAccountId,
210
+ object: inReplyToId, // Required field for REST API
210
211
  message: {
211
212
  attributes: attributes,
212
213
  text: textWithoutMentions || '' // Replace mention spans with the mention text
@@ -226,7 +227,7 @@ async function publish(token,discussionType, mediaId,inReplyToId,socialAccountId
226
227
  ];
227
228
  }
228
229
 
229
- let query = `${LINKEDIN_API}/socialActions/${fixedEncodeURIComponent(inReplyToId)}/comments`;
230
+ let query = `${LINKEDIN_API_REST}/socialActions/${fixedEncodeURIComponent(inReplyToId)}/comments`;
230
231
 
231
232
  // data-listener -> linkedin_api.client sendComment
232
233
  let response;
@@ -619,7 +620,7 @@ export async function likedByUser(
619
620
  try {
620
621
  result = await superagent
621
622
  .get(
622
- `${LINKEDIN_API}/reactions/(actor:${fixedEncodeURIComponent(
623
+ `${LINKEDIN_API_REST}/reactions/(actor:${fixedEncodeURIComponent(
623
624
  authorExternalId
624
625
  )},entity:${fixedEncodeURIComponent(externalId)})`
625
626
  )