Getting Started

  1. Create an app at apps.twitter.com. If you are creating the app on behalf of your company, it is recommended you create the app with a corporate Twitter account.

  2. Enable “Read, Write and Access direct messages” on the permissions tab of your app page.

  3. Generate access tokens for the app owner at the bottom of the “Keys and Access Tokens” tab. On this same tab take note of your Consumer Key, Consumer Secret, Access Token and Access Token secret. You will need these to use the API.

  4. To validate your access to the API, send a DM using Twurl.

    twurl -A 'Content-type: application/json' /1.1/direct_messages/events/new.json -d '{"event": {"type": "message_create", "message_create": {"target": {"recipient_id": "4534871"}, "message_data": {"text": "Hello World!"}}}}'
    
  5. To receive incoming Direct Messages in real-time, see Account Activity Getting Started Guide.