novuhq / novu-kotlin

Kotlin SDK for Novu - The open-source notification infrastructure for engineers. 🚀
MIT License
19 stars 8 forks source link

Bulk trigger throw exception #4

Closed frankkoornstra closed 1 year ago

frankkoornstra commented 1 year ago

I'm trying to use the Bulk Trigger functionality but I'm running into a 400 HTTP status code. Below is the log of the OkHTTPClient (with some stuff redacted or left out because it's not relevant).

To me it looks like the body should be an object with a key events which contains all the events. Now, the events are on the top level as an array.

--> POST https://api.novu.co/v1/events/trigger/bulk 
Content-Type: application/json; charset=UTF-8 
Content-Length: 195 
Authorization: ApiKey <REDACTED> 

[{"to":{"subscriberId":"ac88dd17-32bf-45a6-a863-48961525a87e"},"name":"simple","payload":{"redacted": "redacted"}}] 
--> END POST (195-byte body) 

<-- 400 https://api.novu.co/v1/events/trigger/bulk (694ms) 
date: Fri, 23 Jun 2023 13:24:44 GMT 
content-type: application/json; charset=utf-8 
content-length: 155 
...

{"statusCode":400,"message":["events must contain no more than 100 elements","events should not be empty","events must be an array"],"error":"Bad Request"} 
<-- END HTTP (155-byte body) 
frankkoornstra commented 1 year ago

Thanks for quick turn around on this and #6 :rocket: