platform icon indicating copy to clipboard operation
platform copied to clipboard

Webhook on Rudderstack (Similar to Segment)

Open asennoussi opened this issue 1 year ago • 1 comments

I'm using Webhooks on Rudderstack (Similar to Segment but Opensource) I'm sending this payload from Rudderstack to my Parcelvoy API:

{
    "body": {
        "XML": {},
        "FORM": {},
        "JSON": {
            "type": "track",
            "event": "VAS selected",
            "sentAt": "2024-09-19T16:51:07.365Z",
            "userId": "[OBFUSCATED]",
            "channel": "web",
            "context": {
                "ip": "[OBFUSCATED]",
                "os": {
                    "name": "",
                    "version": ""
                },
                "app": {
                    "name": "RudderLabs JavaScript SDK",
                    "build": "1.0.0",
                    "version": "1.0.15",
                    "namespace": "com.rudderlabs.javascript"
                },
                "page": {
                    "url": "[OBFUSCATED]",
                    "path": "/ar-ma/new",
                    "title": "محكمتي — طلب استشارة جديد",
                    "search": "[OBFUSCATED]",
                    "referrer": "[OBFUSCATED]"
                },
                "locale": "es-ES",
                "screen": {
                    "density": 2.75
                },
                "traits": {
                    "rank": "user",
                    "email": "[OBFUSCATED]",
                    "ui_lang": "ar",
                    "legal_country": "Morocco",
                    "web_notifications_activated": false
                },
                "library": {
                    "name": "RudderLabs JavaScript SDK",
                    "version": "1.0.15"
                },
                "campaign": {},
                "userAgent": "[OBFUSCATED]"
            },
            "rudderId": "[OBFUSCATED]",
            "messageId": "[OBFUSCATED]",
            "timestamp": "2024-09-19T16:51:07.770Z",
            "properties": {
                "vas_type": "urgent-question",
                "vas_value": 52,
                "vas_currency": "MAD",
                "vas_local_value": 502
            },
            "receivedAt": "2024-09-19T16:51:07.775Z",
            "request_ip": "[OBFUSCATED]",
            "anonymousId": "[OBFUSCATED]",
            "integrations": {
                "All": true
            },
            "originalTimestamp": "2024-09-19T16:51:07.360Z"
        },
        "JSON_ARRAY": {}
    },
    "type": "REST",
    "files": {},
    "method": "POST",
    "params": {},
    "userId": "[OBFUSCATED]",
    "headers": {
        "content-type": "application/json",
        "authorization": "Bearer ******466c"
    },
    "version": "1",
    "endpoint": "https://crm.domain.com/api/client/segment"
}

I'm getting error 422: ``` { "response": "{"status":"error","error":"The value of `` must be a array."}", "firstAttemptedAt": "2024-09-19T16:50:36.855Z", "content-type": "application/json; charset=utf-8" }

As the error is not super descriptive, I'm stuck and am looking for help. 

asennoussi avatar Sep 19 '24 17:09 asennoussi

Unfortunately Rudderstacks webhook functionality is maddening terrible. They only allow for sending content wrapped inside of their "body" type which pretty much no other platforms seem to support natively and because you cant remove the wrapper you cant adapt the body to the receivers contract. A full Rudderstack integration would need to be built out to support inbound unfortunately, but outbound events into Rudderstack should work since in theory their API is segment compatible.

pushchris avatar Sep 28 '24 03:09 pushchris

Sorry for the late reply. What Rudderstack shows as payload is actually different from the payload that is being received. (That's misleading) I built an intercepter and they're only lagging a transformation to put everything in an Array. What they seem to do is loop through the payload and send each data individually.

I built a custom relay that only transforms the payload to array and it seems to work. I agree this is on them, thanks for the great piece of software!

asennoussi avatar Dec 03 '24 07:12 asennoussi