Omar Masoud
Omar Masoud

Reputation: 1

Tweetsharp Send Direct Messages

i'm Using Tweetsharp and i try to send messages with using cod C#

SendDirectMessageOptions msgOpt = new SendDirectMessageOptions();
msgOpt.UserId = id;
msgOpt.Text = "text";
var result = service.SendDirectMessage(msgOpt);

This Cod didn't working and I didn't found how to do it

Upvotes: 0

Views: 444

Answers (1)

Yort
Yort

Reputation: 787

There are many things this could be, and not a lot of detail from you. When you say it doesn't work, what do you mean?

Did you get an exception? Does the Response property of the TwitterService instance have any details of the error after you make the SendDirectMessage call?

Things to check: 1. That you are properly authenticated using a user token. 2. That the user token you authenticated with has permission to send direct messages. (https://dev.twitter.com/oauth/overview/application-permission-model-faq#i-adjusted-my-application-permissions-but-the-oauth-login-still-shows-no-permissions-for-direct-messages-should-this-change-have-been-immediate) 3. That the user you are authenticated as AND the user your and sending the direct message to both follow each other. (https://dev.twitter.com/rest/reference/post/direct_messages/new) 4. That there isn't a direct message with the same text from the same user already (Twitter often de-dupes statuses it thinks are duplicates).

Upvotes: 1

Related Questions