Skip to content

Commit f2cd013

Browse files
arnav777devsayan-das-in
authored andcommitted
using cloudeventv1 spec
1 parent 2df3a1c commit f2cd013

1 file changed

Lines changed: 3 additions & 22 deletions

File tree

  • packages/destination-actions/src/destinations/salesforce-marketing-cloud

packages/destination-actions/src/destinations/salesforce-marketing-cloud/sfmc-operations.ts

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,6 @@ interface SFMCAsyncStatus {
3939
resultMessages: string[]
4040
}
4141

42-
/**
43-
* Interface for async upsert response
44-
*/
45-
interface AsyncUpsertResponse {
46-
requestId: string
47-
resultMessages: string[]
48-
}
49-
5042
/**
5143
* Interface for poll response
5244
*/
@@ -153,7 +145,7 @@ export async function asyncUpsertRowsV2(
153145
subdomain: String,
154146
payloads: payload_dataExtension[] | payload_contactDataExtension[],
155147
dataExtensionId?: string
156-
): Promise<MultiStatusResponse> {
148+
) {
157149
if (!dataExtensionId) {
158150
throw new IntegrationError(
159151
`In order to send an event to a data extension Data Extension ID must be defined.`,
@@ -163,25 +155,14 @@ export async function asyncUpsertRowsV2(
163155
}
164156
// Use flattened rows for async API
165157
const rows = generateFlattenedRows(payloads)
166-
const response = await request<AsyncUpsertResponse>(
158+
const response = await request(
167159
`https://${subdomain}.rest.marketingcloudapis.com/data/v1/async/dataextensions/${dataExtensionId}/rows`,
168160
{
169161
method: 'PUT',
170162
json: { items: rows }
171163
}
172164
)
173-
const multiStatusResponse = new MultiStatusResponse()
174-
for (let i = 0; i < payloads.length; i++) {
175-
multiStatusResponse.setSuccessResponseAtIndex(i, {
176-
status: 202,
177-
sent: rows[i] as Object as JSONLikeObject,
178-
body: {
179-
requestId: response.data.requestId,
180-
resultMessages: response.data.resultMessages
181-
}
182-
})
183-
}
184-
return multiStatusResponse
165+
return response
185166
}
186167

187168
export function upsertRows(

0 commit comments

Comments
 (0)