@meltwater/conversations-api-services 1.1.16 → 1.1.17

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.
@@ -150,11 +150,6 @@ async function privateMessage(token, messageText, inReplyToId, sourceId, mediaId
150
150
  };
151
151
  }
152
152
  async function publish(token, discussionType, mediaId, inReplyToId, socialAccountId, messageText, logger) {
153
- // for now this is needed to make the urns from the images api work until the docs are updated to reflect how to use these new ids.
154
- if (mediaId) {
155
- mediaId = mediaId.replace('urn:li:image:', 'urn:li:digitalmediaAsset:');
156
- }
157
-
158
153
  // Extract mentions from the messageText
159
154
  // https://learn.microsoft.com/en-us/linkedin/compliance/integrations/shares/ugc-post-api?tabs=http#memberattributedentity
160
155
  const mentionRegex = /<span class="highlight-mention" data-mention-id="([^"]+)"[^>]*>([^<]+)<\/span>/g;
@@ -193,11 +188,11 @@ async function publish(token, discussionType, mediaId, inReplyToId, socialAccoun
193
188
  body.parentComment = inReplyToId;
194
189
  }
195
190
  if (mediaId) {
191
+ const imageUrn = mediaId.replace('urn:li:digitalmediaAsset:', 'urn:li:image:');
196
192
  body.content = [{
197
193
  entity: {
198
- digitalmediaAsset: mediaId
199
- },
200
- type: 'IMAGE'
194
+ image: imageUrn
195
+ }
201
196
  }];
202
197
  }
203
198
  let query = `${LINKEDIN_API_REST}/socialActions/${fixedEncodeURIComponent(inReplyToId)}/comments`;
@@ -128,11 +128,6 @@ export async function privateMessage(token, messageText, inReplyToId, sourceId,
128
128
  };
129
129
  }
130
130
  async function publish(token, discussionType, mediaId, inReplyToId, socialAccountId, messageText, logger) {
131
- // for now this is needed to make the urns from the images api work until the docs are updated to reflect how to use these new ids.
132
- if (mediaId) {
133
- mediaId = mediaId.replace('urn:li:image:', 'urn:li:digitalmediaAsset:');
134
- }
135
-
136
131
  // Extract mentions from the messageText
137
132
  // https://learn.microsoft.com/en-us/linkedin/compliance/integrations/shares/ugc-post-api?tabs=http#memberattributedentity
138
133
  const mentionRegex = /<span class="highlight-mention" data-mention-id="([^"]+)"[^>]*>([^<]+)<\/span>/g;
@@ -171,11 +166,11 @@ async function publish(token, discussionType, mediaId, inReplyToId, socialAccoun
171
166
  body.parentComment = inReplyToId;
172
167
  }
173
168
  if (mediaId) {
169
+ const imageUrn = mediaId.replace('urn:li:digitalmediaAsset:', 'urn:li:image:');
174
170
  body.content = [{
175
171
  entity: {
176
- digitalmediaAsset: mediaId
177
- },
178
- type: 'IMAGE'
172
+ image: imageUrn
173
+ }
179
174
  }];
180
175
  }
181
176
  let query = `${LINKEDIN_API_REST}/socialActions/${fixedEncodeURIComponent(inReplyToId)}/comments`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meltwater/conversations-api-services",
3
- "version": "1.1.16",
3
+ "version": "1.1.17",
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",
@@ -172,14 +172,6 @@ export async function privateMessage(token, messageText, inReplyToId, sourceId,
172
172
  }
173
173
 
174
174
  async function publish(token,discussionType, mediaId,inReplyToId,socialAccountId, messageText, logger) {
175
- // for now this is needed to make the urns from the images api work until the docs are updated to reflect how to use these new ids.
176
- if (mediaId) {
177
- mediaId = mediaId.replace(
178
- 'urn:li:image:',
179
- 'urn:li:digitalmediaAsset:'
180
- );
181
- }
182
-
183
175
  // Extract mentions from the messageText
184
176
  // https://learn.microsoft.com/en-us/linkedin/compliance/integrations/shares/ugc-post-api?tabs=http#memberattributedentity
185
177
  const mentionRegex = /<span class="highlight-mention" data-mention-id="([^"]+)"[^>]*>([^<]+)<\/span>/g;
@@ -216,14 +208,15 @@ async function publish(token,discussionType, mediaId,inReplyToId,socialAccountId
216
208
  if (discussionType === 're') {
217
209
  body.parentComment = inReplyToId;
218
210
  }
211
+
219
212
  if (mediaId) {
213
+ const imageUrn = mediaId.replace('urn:li:digitalmediaAsset:', 'urn:li:image:');
220
214
  body.content = [
221
215
  {
222
216
  entity: {
223
- digitalmediaAsset: mediaId,
224
- },
225
- type: 'IMAGE',
226
- },
217
+ image: imageUrn
218
+ }
219
+ }
227
220
  ];
228
221
  }
229
222