question

shirucharmin avatar image
shirucharmin asked

Webhook problems

I want to use the playstream event pipe with a webhook to my local server. I'm using a .js application to listen to a port, which first was only working from Postman, I had to create a new title to make it work, maybe it would have solved itself after some time but that at least worked for me. Now events are received but the Body is empty.

if I take that json file from the debugger and post it into Postman ( shortened here) it works fine

code for the endpoint is :

const express = require("express");

const app = express();

const bodyParser = require("body-parser");
app.use(bodyParser.json());

app.post("/ReportEvent",(req,res)=>{
console.log("getdata");
console.log("req.body ",req.body);
});

const server = app.listen(44444 ,()=>{
console.log("Server started on port ",server.address().port);
});

what am i doing wrong , how do i get the full event json file from the webhook?

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

shirucharmin avatar image
shirucharmin answered

Ehh, figured out what the problem was. Content-Type header was missing completely. I just assumed it would be json

workaround from https://github.com/expressjs/body-parser/issues/76 worked.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image
brendan answered

I'm really not sure how you're set up right now, based upon that, but to use webhooks to send PlayStream events to your own endpoints, you need to:

1. Stand up a server that is listening on either port 80 (for non-SSL) or 443 (for SSL) POST messages. We strongly recommend that you use SSL, for security of your data. If you're sending any event data that contains any potential PII (IP addresses, email addresses, etc.), you should really think of this as a requirement, or else you run a very real risk of not treating player data appropriately. If you have questions about that, you should discuss it with your legal counsel.

2. Configure the Analytics->Webhook tab to use the endpoint of your server, and designate the filtering you want to use (all events, or just a subset).

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.