parcelvoy / platform

Parcelvoy: Open source multi-channel marketing automation platform. Send data-driven emails, sms, push notifications and more!
https://parcelvoy.com
MIT License
261 stars 47 forks source link

Webhook on Rudderstack (Similar to Segment) #505

Open asennoussi opened 2 months ago

asennoussi commented 2 months ago

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. 
pushchris commented 1 month ago

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.