Tweet intent response the same for successful and unsuccessful posts



It seems that the Twitter web intents tweet event returns a response as soon as the tweet is opened instead of returning a response when the post is actually published. Is there any way to return something once the post is actually published and return null or undefined if the window is closed without the post being published?

I’m binding the tweet event to a click event on several elements on a page like this:

$.each($('a[data-bird].twitter'), function() { //Add tweet href to Twitter buttons on page load
			var $birdName = $(this).attr('data-bird'),
				$birdImage = $(this).attr('data-birdimage'),
				$birdText = $(this).attr('data-twitter');
			$(this).attr('href', '' + encodeURIComponent($birdText) + '' + $birdImage);

		twttr.ready(function (twttr) { //When Twitter is ready
			//console.log('Twitter Ready');

			$('a[data-bird].twitter').on('click', function() {//When Twitter link clicked
				var $birdName = $(this).attr('data-bird'), 
					$socialChannel = $(this).attr('data-smchannel'),
					$trackShare = function() { //Track Twitter sharing function
							'vpurl': $birdName,
							'channel': $socialChannel
					};'tweet', function(intentEvent) { //Bind tweet event
					if (!intentEvent) { 
					} else {
						if ($swapBirds === undefined) { //If no cookies are set
							Cookies.set('shownBirds', $birdName, { path: '' }); //Set cookies
							$swapBirds = Cookies.get('shownBirds'); //Update variable
							$('img[data-bird="' + $birdName + '"]').attr('src', 'img/birds/' + $birdName + '.png'); //Swap image
							$thankYou(); //Show thank you message
							//$showEasterEgg(); //Show easter egg
							$trackShare(); //Track sharing event
						} else { //If cookies are set
							if ($.inArray( $birdName, Cookies.get('shownBirds').split('&') ) !== -1) { //If bird is in array
								return; //Do nothing if image has already been shared
							} else if ($.inArray( $birdName, Cookies.get('shownBirds').split('&') ) === -1) { //If bird is not in array
								Cookies.set('shownBirds', $swapBirds + '&' + $birdName, { path: '' }); //Set cookies
								$swapBirds = Cookies.get('shownBirds'); //Update variable
								$('img[data-bird="' + $birdName + '"]').attr('src', 'img/birds/' + $birdName + '.png'); //Swap image
							$thankYou(); //Show thank you message
							//$showEasterEgg(); //Show easter egg
							//$goToNewSlide(); //Go to easter egg slide
							$trackShare(); //Track sharing event


Correct. The change in event behavior was announced then implemented on November 20.


Hi, i have the same issue. It’s very frustrating. How can we make a real interaction between twitter and our website now ?
I absolutely need to have a callback once the tweet is posted not before, have you a solution ?


Can you please share more details about “absolutely need to have a callback once the Tweet is posted not before?”

How are you currently tracking the success rate today on platforms where the callback will never be available, such as mobile views of your content?



I need to make an instant win web app, i used REST API to authenticate the user so i call web intent and need to know if they really post the message on their profile. Before, the event will be triggered when the user publishes a Tweet (either new, or a reply) through the Tweet Web Intent. Now it’s impossible the event return a response on popup opening. I’ve tried to do everything with REST API but the twitter app was always bannished as it was considered like spam because the message post is the same for each account. That’s why i choose to use web intent. Do you have a cleaner way to do that, maybe i miss something with the REST API…


Have you an answer for me about how to do it ?

Thank you


I am sitting in the same boat as cadcatcet. We run multiple sweepstakes applications where we use the Twitter widget. We required the user to share via Twitter (aka Tweet) a pre filled tweet. We relied upon the tweet event to trigger a form submission. This gave us at least at a very minimum, a rough assumption that the user did tweet like we were hoping, thus giving us enough to allow them to enter.

Originally, I had hooked up to the API, but Twitter suspended it due to “spamming”? I still don’t completely understand as to why, since every user authorized us to post the tweet on their behalf.

Anywho, with this Web Intent update, why even have the “Click” event if that is how the “Tweet” event is going to work. Are we able to hook into clicking the actual “Tweet” button of the pop up window?


The click event and tweet event do now fire at the same time.

The distinct names are maintained partly to provide a level of continuity and backwards compatible for many uses of the event, and also so that in more complex widgets (such as embedded Tweets), one can distinguish a click that occurs on the follow button or reply button, for example.

As I said in the other thread, the problem was that in around half of all cases the old tweet event was no longer being fired, and that situation is only going to get worse as iOS and Android adoption continues to increase. The API was broken by circumstances and we can’t maintain that.

For you kind of user case, perhaps the way to approach it would be to use the streaming API to consume Tweets mentioning your account, and use that to confirm someone’s entry into your contest, that way your verification is separate from whatever composer the user has used.



Hi i have also same problem. In my case twitter sharing button is in a popup. We need after successfully posting these pop up should close. currently after clicking on button our pop up is close but we need after successful posting it should close because this is working as a prevention of downloading my pdf.
Means any one can download the PDF after only sharing my post.But currently without successful sharing he can also download.
So please suggest me any other way for this.


I think @benward’s suggestion above would also work in your case, i.e. listening for the share of your post on something like the use of a hashtag. Unfortunately as Ben and Niall have explained, this isn’t something that is easy to provide as it was before, given the current technical progression and need to support mobile etc.


No one suggesting the way to fix @cadcadcet, @SwarmingDev, @Rohit problem.

Is it possible to confirm a tweet in the Javascript API?
Is it possible to confirm a tweet in the Javascript API?

Seems to be the one of the possible solutions.

closed #13