If you are getting an "invalid payload" error when sending events to the insights API, we would recommend reviewing your event data parameters to make sure they are in the expected format.
For example,
insights.send_event({
eventType: 'click',
//eventType must be a string
eventName: 'Article clicked',
//eventName must be a string
index: 'Article_development',
//index must be a string, it's the same as the index name used by the search engine
userToken: '1234567',
//userToken must be a string
objectIDs: ["1234"],
//objectIDs is optional, must be an array
positions: [1],
//Position must be an integer
//Click positions start at 1, not 0.
//This is required if a queryID is provided. You must provide one position for each objectID
queryID: 'af8fbc03e56d7d519f0f795ee2c01cf32',
//queryID must be a string, this is required when an event is tied to a search
timestamp: 1655351882000
//timestamp must be an integer, expressed in milliseconds
//timestamp has to be within the last four days. If not, the event will be rejected
})
For more information on Send Events Parameters, please review the documentation here.