Webhooks API: Reading the payload


#1

I can’t seem to find how to read the actual payload data coming from Twitter, can someone point me to the correct documentation page? Thanks in advance!

Update: For the record, I’m using node.js.

I did read through https://dev.twitter.com/webhooks/receiving-events and I’m probably just missing something, but I don’t see anything in the incoming data that contains the direct_message_events object.


#3

Hi @stefan,

Assuming your webhook is configured properly and you are using express with node.js, your webhook handler would look something like this:

app.post('/webhooks/twitter', function(request, response) {
    console.log(request.body)
    response.send('200 OK');
});

request.body being the incoming JSON POST body.


#4

Got it working now, thank you!