I am trying to use Twit to send and receive Twitter DMs.
When I create a stream like this:
var stream = T.stream('user');
I get a 404 error. I believe this is because the user stream has been deprecated.
What stream can I use instead to send and receive DMs?
That's correct, you will need to use the Account Activity API to receive Direct Messages in realtime. This is a webhook-based API. Twitter has a migration guide.
In summary:
There's also a full tutorial on this using a JavaScript package called autohook
.