tweetinvi: PublishTweetWithImage not working

Tweet.PublishTweetWithImage is not working for me. I receive no errors, it just doesn’t post to Twitter.

Tweetinvi version = 1.2.0.1 (nuget package)

I’m using it in an asp.net MVC application as follows:

byte[] imageBytes = webClient.DownloadData( imageUrl );
Tweet.PublishTweetWithImage( text, imageBytes );

The image is fine, example: http://s123.eu/uploads/media/1/b9272763d8e640b1ba16.jpg I receive the byte data, no issues there. Tweetinvi just doesn’t seem to post it on Twitter.

I also use Tweet.PublishTweet for tweets without image and that is working fine.

I also tried this alternative, but it is also not working:

var media = Tweetinvi.Upload.UploadImage( imageBytes );
Tweet.PublishTweet( text, new PublishTweetOptionalParameters { Medias = { media } } );

Any suggestions? Thanks. @Asshen

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 36 (4 by maintainers)

Most upvoted comments

This also works,

 var media = Tweetinvi.Upload.UploadImage(imageBytes);
            Tweet.PublishTweet("Testing Tweet With Image 2", new PublishTweetOptionalParameters { Medias = { media } });
public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            Auth.SetUserCredentials("CONSUMER_KEY", "CONSUMER_SECRET",
"ACCESS_TOKEN", "ACCESS_TOKEN_SECRET");
        }

        private void button1_Click(object sender, EventArgs e)
        {
            var webClient = new WebClient();
            byte[] imageBytes = webClient.DownloadData("
http://unkindbrotherhood.com/favicon.png");
            var media = Tweetinvi.Upload.UploadImage(imageBytes);
            Tweet.PublishTweet("Testing Tweet With Image 2", new PublishTweetOptionalParameters { Medias = { media } });

        }
    }

Just tested just the tweetwithmedia model, public partial class Form1 : Form { public Form1() { InitializeComponent(); Auth.SetUserCredentials(“CONSUMER_KEY”, “CONSUMER_SECRET”, “ACCESS_TOKEN”, “ACCESS_TOKEN_SECRET”); }

    private void button1_Click(object sender, EventArgs e)
    {
        var webClient = new WebClient();
        byte[] imageBytes = webClient.DownloadData("

http://unkindbrotherhood.com/favicon.png"); Tweet.PublishTweetWithImage(“Testing Tweet With Media”, imageBytes);

    }
}

I replaced my keys and tokens with CONSUMER_KEY etc. just so that my keys aren’t available on email/github here

On Thu, Feb 2, 2017 at 8:04 PM, Unkind Jolt unkindjolt@gmail.com wrote:

*manually

On Thu, Feb 2, 2017 at 8:03 PM, Unkind Jolt unkindjolt@gmail.com wrote:

Also how are you authenticating the user? is it PIN or using the C,CS,AT,ATS manaully?

On Thu, Feb 2, 2017 at 8:03 PM, Unkind Jolt unkindjolt@gmail.com wrote:

Are you trying to get the image from a tweet, to then tweet using the account that is authorised? " public bool Post( [FromBody]TwitterPostData data ) " " string image = data.image; "

On Thu, Feb 2, 2017 at 7:44 PM, Unkind Jolt unkindjolt@gmail.com wrote:

No problem 😃

On Thu, Feb 2, 2017 at 7:44 PM, Asshen notifications@github.com wrote:

Thank you for your help.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/linvi/tweetinvi/issues/450#issuecomment-276899006, or mute the thread https://github.com/notifications/unsubscribe-auth/AYTGkxwREvH6ZtYMmSTq3k0fKjMRkCMfks5rYZdRgaJpZM4LxmVn .