Twitter began life as an SMS-based service, and back in 2006 when the REST API was initially conceived, many of the original SMS commands were provided through the API, for ease of development.
Specifically, if the text of a Tweet status update starts with the characters D, M, or DM, followed by a user’s screen name, a Direct Message will be sent to the named user (assuming this is possible, based on account settings and follow relationship). Alternate leading characters are used, depending on the language.
The API has moved on, and as the platform and product has evolved, it is now time to remove some of these legacy API behaviors.
We’re kicking off an extended transition away from the availability of DM commands used through statuses/update on the REST API. We’ll shortly update the documentation for the statuses/update endpoint to reflect the addition of two new optional parameters to control these behaviors. We expect that the majority of applications should already be using the correct direct_message API endpoints to compose messages, and there will be no changes to those endpoints as part of this transition.
- Effective immediately, the optional
enable_dm_commands parameter to statuses/update will enable applications to remove DM command support early, before the transition period ends. The default value is true (i.e. current legacy behavior), but this may be set to false to get the new, post-November 1 behavior now.
- Effective immediately, the optional
fail_dm_commands parameter to statuses/update will make DM commands return HTTP 403 (error code 151) from the API when set to true. The default value is false.
- On October 1, 2017, the default value of
fail_dm_commands will be switched to true. From this time, all status updates intended as Direct Messages will start to return errors (unless enable_dm_commands is false, in which case the Tweet will be posted).
- As from November 1, 2017, the ability to send Direct Messages via the
statuses/update API endpoint will be completely removed, and the above two parameters will no longer have any effect.
Note that the statuses/update_with_media endpoint will also accept these new flags during the same period. However, that endpoint has been deprecated for several years, and will eventually be removed. Code should be updated to use the media/upload endpoint in conjunction with statuses/update in order to post media with Tweets on Twitter.
There is no change to the use of Twitter via SMS, and these commands will still operate via those channels as before.
Please feel free to ask questions about this change via the REST API category. Thanks!