POST statuses/update: Special command question



Hi all,

I have a question about the special commands referred to in the POST statuses/update endpoint.

The description for the status parameter in the endpoint says this:

The text of your status update, typically up to 140 characters. URL encode as necessary. link wrapping may affect character counts. There are some special commands in this field to be aware of. For instance, preceding a message with “D ” or “M ” and following it with a screen name can create a direct message to that user if the relationship allows for it.

I’ve looked at the special commands, and found something odd. When I attempted to post a tweet that began “M, by @username” the API attempted it to send it as a direct message: fine, I expected that.

However, when I tried these:

" M, by @username" (space in front of M)
"[M], by @username"
"-M, by @username"

All of the above still attempted to send a DM - the API isn’t being very clear about what one should do to escape this functionality, given that "M " and "D ", as specified there, clearly aren’t the only beginning characters that the API recognises as DM commands.

Does anyone have more information about precisely how the API interprets this?


Those commands are not interpreted by the API itself but by Twitter in general. There is a support page but it doesn’t specify what characters are discarded when identifying the SMS commands.