question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PublishTweetWithImage not working

See original GitHub issue

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

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
Unkindjoltcommented, Feb 2, 2017

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 } });

        }
    }
1reaction
Unkindjoltcommented, Feb 2, 2017

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 .

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - TweetInvi Listview can't get TweetID
Here is my code. Problem occurs when i select desired Item from view and press retweet. namespace MIF_TwitterApplication { public partial class ...
Read more >
Tweetinvi a friendly Twitter C# library - RSSing.com
I just want to ask a question about a weird issue that I have been facing. I setup a filtered stream so I...
Read more >
Using F# to power an AWS IoT Button | by Jacqueline Nolis
NET Core installed, my next step was to try and get any F# code working with it. I followed this guide on Medium,...
Read more >
The Content Of Your Tweet Is Invalid
I think all the solutions that include access keys stuff will not work. The problem is that Twitter can not send you a...
Read more >
The Content Of Your Tweet Is Invalid
Twitter Developer Platform">Troubleshooting Cards. If you're having trouble Tweeting via the web ... Unable to publish Tweet with image using MediaIds #977.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found