O'Reilly logo

Sams Teach Yourself the Twitter API in 24 Hours by Chia Hwu, Jon Wu, Ben Ho, Christopher Peri

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Hour 12. Direct Messages

What You’ll Learn in This Hour:

Send direct messages through the API

Test for the existence of friendships between users

How to delete direct messages using destroy method

Sending a Direct Message

Although we have briefly discussed direct messages in Hour 10, in this hour we add support for sending direct messages, as well as a few other methods. We will also look at another set of API calls, called friends, in order to know if we can send a direct message in the first place.

Adding UI Elements for Direct Messages

However, the first thing we will do is revisit reading our direct messages. Because we already have this in our API set, we just need to populate the button on our UI.

Edit index.php

After this line: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required