Message Create Object

Message Create Object

Direct Message Event objects are returned by GET direct_messages/events/listGET direct_messages/events/show and can be consumed in real-time using the Account Activity API. Direct Messages have the type of message_create.

      {
  "type": "message_create",
  "id": "1234858592",
  "created_timestamp": "1392078023603",
  "initiated_via": {
    "tweet_id": "123456",
    "welcome_message_id": "456789"
  },
  "message_create": {
    "target": {
      "recipient_id": "1234858592"
    },
    "sender_id": "3805104374",
    "source_app_id": "268278",
    "message_data": {
      "text": "Blue Bird",
      "entities": {
        "hashtags": [],
        "symbols": [],
        "urls": [],
        "user_mentions": [],
      },
      "quick_reply_response": {
        "type": "options",
        "metadata": "external_id_2"
      },
      "attachment": {
        "type": "media",
        "media": {
         ...
        }
      }
    }
  }
}
    

Top level event object

Property Description
type The type of event. For Direct Messages type will be message_create.
id The ID of the direct message event.
created_timestamp Epoch timestamp of when the Direct Message event was created.
initiated_via.tweet_id The ID of the Tweet with Direct Message Prompt the conversation was initiated from if one was used.
initiated_via.welcome_message_id The ID of the Welcome Message immediatley preceding the conversation if one was used.

message_create object

message_create.target.recipient_id The ID of the user receiving the message.
message_create.sender_id The ID of the user sending the message.
message_create.source_app_id The ID of the application used to create the event. App details are available in the apps object in JSON payloads containing message_create events.
message_create.message_data message_data object.

message_data object

message_data.text The Direct Message text.
message_data.entities A Twitter entities object.
message_data.quick_reply_response Quick Reply response object.
message_data.attachment An attachment object (media)