rudderlabs / rudder-transformer

Open-source, warehouse-first Customer Data Pipeline and Segment-alternative. Collects and routes clickstream data and builds your customer data lake on your data warehouse.
https://www.rudderstack.com
Other
84 stars 112 forks source link

BUG: `ip_address` and `user_agent` should be in a single identifiers object. Error: At least one user identifier must be provided #3909

Open amerkay opened 1 day ago

amerkay commented 1 day ago

Describe the bug Error response from X: At least one user identifier must be provided.

Why it's happening: The ip_address and user_agent are placed at the conversion object level rather than combined identifier following the X docs.

See X Docs: https://developer.x.com/en/docs/x-ads-api/measurement/web-conversions/api-reference/conversions

From Docs:

IP address is required to be passed in conjunction with another identifier (twclid, email address, phone number or user agent).

User Agent is required to be passed in conjunction with another identifier (twclid, email address, phone number or IP address).
{
  "conversions":[
     {
        ...
        "identifiers":[
           {
              "ip_address":"1.0.0.0",
              "user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36"
           }
        ],
        ...
     }
  ]
}

To Reproduce When I send ip_address and user_agent properties, this happens.

Payload:

{
    "version": "1",
    "type": "REST",
    "method": "POST",
    "endpoint": "https://ads-api.twitter.com/12/measurement/conversions/oryuz",
    "headers": {
        "Authorization": "******1.0\"",
        "Content-Type": "application/json"
    },
    "params": {},
    "body": {
        "JSON": {
            "conversions": [
                {
                    "ip_address": "99.32.47.242",
                    "user_agent": "Mozilla/5.0 (X11; Linux x86_64; rv:133.0) Gecko/20100101 Firefox/133.0",
                    "event_id": "tw-oryuz-os64j",
                    "conversion_time": "2024-12-01T20:39:43.240Z",
                    "identifiers": [
                        {
                            "hashed_email": "47c0c081d3916b87b3301ae04d29ca990eb8ce4c22b4fa53f0e25e4fb1583f58"
                        },
                        {
                            "ip_address": "99.32.47.242"
                        },
                        {
                            "user_agent": "Mozilla/5.0 (X11; Linux x86_64; rv:133.0) Gecko/20100101 Firefox/133.0"
                        }
                    ]
                }
            ]
        },
        "JSON_ARRAY": {},
        "XML": {},
        "FORM": {}
    },
    "files": {}
}

Error response from Twitter:

{
  "response": "{\"errors\":[{\"code\":\"INVALID_PARAMETER\",\"message\":\"At least one user identifier must be provided\",\"parameter\":\"\"}],\"request\":{\"params\":{\"account_id\":\"18ce55453yk\"}}}",
  "firstAttemptedAt": "2024-12-01T20:39:59.109Z",
  "content-type": "application/json; charset=utf-8",
  "routerSubStage": "router_dest_delivery",
  "payloadStage": "router_input"
}

Expected behavior ip_address and user_agent should be in a single object, not two separate ones: { "ip_address":"1.0.0.0", "user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36" }

Screenshots If applicable, add screenshots to help explain your problem.

Additional context See: https://github.com/rudderlabs/rudder-transformer/blob/275e971c70f2a025a6b393ea37f038bb57c8c3a2/src/v0/destinations/twitter_ads/transform.js#L134

contributor-support[bot] commented 1 day ago

Thanks for opening this issue! We'll get back to you shortly. If it is a bug, please make sure to add steps to reproduce the issue.