Skip to content

Dataprovider added in ms bing capi#3718

Open
AnkitSegment wants to merge 3 commits intomainfrom
STRATCONN-6726-capi-providername
Open

Dataprovider added in ms bing capi#3718
AnkitSegment wants to merge 3 commits intomainfrom
STRATCONN-6726-capi-providername

Conversation

@AnkitSegment
Copy link
Copy Markdown
Contributor

In this PR, dataProvider key added in Microsoft BING CAPI.

JIRA ticket: https://twilio-engineering.atlassian.net/browse/STRATCONN-6726

Testing

Include any additional information about the testing you have completed to
ensure your changes behave as expected. For a speedy review, please check
any of the tasks you completed below during your testing.

  • Added unit tests for new functionality
  • Tested end-to-end using the local server
  • [If destination is already live] Tested for backward compatibility of destination. Note: New required fields are a breaking change.
  • [Segmenters] Tested in the staging environment
  • [Segmenters] [If applicable for this change] Tested for regression with Hadron.

Security Review

Please ensure sensitive data is properly protected in your integration.

  • Reviewed all field definitions for sensitive data (API keys, tokens, passwords, client secrets) and confirmed they use type: 'password'

New Destination Checklist

  • Extracted all action API versions to verioning-info.ts file. example

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for a dataProvider attribute in the Microsoft Bing CAPI destination action payload so events can declare the source of event data.

Changes:

  • Adds dataProvider to the action mapping schema and generated payload types.
  • Includes dataProvider in the outbound Bing CAPI request item (defaulting to SEGMENT).
  • Updates request item typings to include dataProvider.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
packages/destination-actions/src/destinations/ms-bing-capi/sendEvent/types.ts Adds dataProvider to the request item type (and touches nearby request field typings).
packages/destination-actions/src/destinations/ms-bing-capi/sendEvent/index.ts Maps dataProvider into the request payload and sets a default.
packages/destination-actions/src/destinations/ms-bing-capi/sendEvent/generated-types.ts Updates generated Payload typing/docs to include dataProvider.
packages/destination-actions/src/destinations/ms-bing-capi/sendEvent/fields.ts Exposes dataProvider as an optional mapped field with default SEGMENT.
Comments suppressed due to low confidence (1)

packages/destination-actions/src/destinations/ms-bing-capi/sendEvent/index.ts:44

  • ...data is spreading the imported data InputField definition (from ./fields) into the outbound request item, not the payload's data object. The destructuring at line 36 does not create a data variable, so this will add keys like label, type, properties, etc. to the request body. Rename/alias the imported field (e.g., import { data as dataField } ... and use fields: { data: dataField, ... }) and then bind const { data = {} } = payload so ...data refers to the payload data.
    const {
      data: { eventTime, eventType, adStorageConsent, eventSourceUrl, eventName, dataProvider } = {},
      userData: { em, ph, ...restOfUserData } = {},
      customData,
      items,
      hotelData
    } = payload
    const jsonItem: BingCAPIRequestItem = {
      ...data,
      eventType: eventType as 'pageLoad' | 'custom',

Comment on lines +63 to +64
console.log('Processing payload: ', jsonItem)

Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove console.log('Processing payload:', jsonItem). This logs full event payloads (including identifiers / user data) to stdout, which can leak customer data and generate excessive noise in production. If diagnostics are needed, use the action logger with redaction and only log minimal metadata (or remove entirely).

Suggested change
console.log('Processing payload: ', jsonItem)

Copilot uses AI. Check for mistakes.
Comment on lines 18 to +23
pageLoadId?: string
referrerUr?: string
pageTitle?: string
keywords?: string
adStorageConsent?: string
dataProvider?: string
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The request item type defines referrerUr?: string (missing the trailing l), but the field/mapping uses referrerUrl. This mismatch makes the type inaccurate and can hide bugs when building the request payload. Rename the interface property to referrerUrl (and verify any other references) to align with the mapped field name.

Copilot uses AI. Check for mistakes.
Comment on lines 46 to 50
adStorageConsent: adStorageConsent ?? settings.adStorageConsent,
eventSourceUrl: eventSourceUrl,
eventName: eventName,
dataProvider: dataProvider ?? 'SEGMENT',
userData: {
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dataProvider behavior is added (defaulting to 'SEGMENT' when not provided), but there are existing unit tests for this action and none assert that dataProvider is sent correctly. Add tests covering (1) default behavior when omitted and (2) override behavior when a custom dataProvider is mapped, so future refactors don't break this field silently.

Copilot generated this review using guidance from repository custom instructions.
Copilot AI review requested due to automatic review settings April 14, 2026 07:15
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants