-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add support for inbound webhooks that use form data #1998
base: main
Are you sure you want to change the base?
feat: Add support for inbound webhooks that use form data #1998
Conversation
Shouldn't the JOSN payload received at the endpoint be this? {
"name": "legbegbe",
"error": "no error",
"status": "success"
} |
@jirevwe You're right. However, I did it that way because the return type of FormData is actually a map of the structure |
@jirevwe Updated. |
It works but struggles with nested values. This curl -L -X POST 'http://localhost:5005/ingest/bRR0NEtU6sw0ZeD3' \
-H 'Authorization: Bearer CO.Ci4jlWTc4gJeWnXZ.NatfMfQM3Ks78Y3Ibm6XKqwCLS1eG35kNwcRe6jd42mOc0EdzBu5JCl9qZHJhSBE' \
-F 'endpoint_id="01HS16E631RTHZ2EN4K54ZFC9H"' \
-F 'data[event_type]="created"' \
-F 'data[name]="digital"' \
-F 'data[email]="Aurelie6@hotmail.com"' \
-F 'data[age]="10"' \
-F 'custom_headers[id]="2aff13ec-a373-4218-9fde-0c1328801291"' \
-F 'custom_headers[timestamp]="2024-03-20T06:56:06.991Z"' \
-F 'custom_headers[x-tenant-id]="xpi"' \
-F 'idempotency_key="test123"' \
-F 'event_type="created"' comes out as {
"data": {
"data[age]": "10",
"data[name]": "auxiliary",
"event_type": "created",
"data[email]": "Alexa86@gmail.com",
"endpoint_id": "01HS16E631RTHZ2EN4K54ZFC9H",
"idempotency_key": "test123",
"data[event_type]": "created",
"custom_headers[id]": "2aff13ec-a373-4218-9fde-0c1328801291",
"custom_headers[timestamp]": "2024-03-20T06:56:06.991Z",
"custom_headers[x-tenant-id]": "xpi"
},
"event_type": "created",
"endpoint_id": "01HS6EX2KC8FMN8NDTMNKQQN13",
"custom_headers": {
"header": "valve"
}
} |
Closes #1987
This PR adds support for inbound webhooks that send data via
form-data
. It defaults toJSON
when the content type isn'tmultipart/form-data
to avoid introducing a breaking change. As time goes one, we'll want to add support forwww-url-encoded
.