Auto post to twitter problem

Jon White asked on November 19, 2014 12:01

Hi there,

I'm having trouble implementing the twitter auto post on my document type.

I have a custom document type with the twitter auto post field all set the same as the example, but when I tweet I get an error: 'Error occured while sending Tweet.'

I have filled out the twitter settings i.e. access token, key etc... and double checked it but no joy.

Does anyone know what i might be doing wrong or have experienced any issues themselves? I also thought there was a checkbox for 'tweet after publish' but it isn't there.

I'm running v7.0.103

Thank you in advance Jon

Recent Answers

Vilém Jeniš answered on November 20, 2014 16:07

Hi Jon!

I'm sorry to say that, but twitter changes API quite often. However, could you please see whether you have a record in the Event log about this error? There should be an error which reads "Error occurred while parsing response." or "Error occurred while sending a tweet.". This would mean, that Twitter has changed its API behaviour.

The tweet after publish checkbox was added in the version 8, where the twitter and Facebook integration was re-done and is continuously improved upon. Hotfixes ensure catching up with changes in the API like these (Facebook api changes) for example. The twitter and Facebook integration is a lot better in the version 8. Try it out with a free trial. (You can get one on the site. ☺)

Let's look at the Event log reports now...

0 votesVote for this answer Mark as a Correct answer

Jon White answered on November 20, 2014 16:22

Hi There,

Thank you my event log is as follows:

Error occurred while sending a tweet. Message: The remote server returned an error: (401) Unauthorized. Stack Trace: at System.Net.HttpWebRequest.GetResponse() at CMS.SocialNetworking.OAuthTwitter.WebResponseGet(HttpWebRequest webRequest) at CMS.SocialNetworking.OAuthTwitter.WebRequest(HttpMethodEnum method, String url, String postData) at CMS.SocialNetworking.OAuthTwitter.OAuthWebRequest(HttpMethodEnum method, String url, String postData) at CMS.SocialNetworking.TwitterProvider.PublishTweet(String text, String consumerKey, String consumerSecret, String token, String tokenSecret, Boolean shortenUrls)

I think it's probably API related, I know it changed earlier in the year and caused havoc!

I guess we'll have to hurry up and upgrade to K8!

Thanks, Jon

0 votesVote for this answer Mark as a Correct answer

Vilém Jeniš answered on November 25, 2014 09:40

Hello again!

I'm sorry for the late response but I'd like to believe that the extra time has allowed me to come up with a more plausible and helpful answer to your problem and possibly even a solution. You'll be the judge of that.

I've managed to reproduce your exception in two ways:

  1. I've added a blank character to one of the credentials fields in the settings. Since the values or at least some of them aren't trimmed, pay attention to blank characters at the end and the beginning of the value you enter into the field.
  2. The more probable problem are permissions. Not Kentico permissions, but the ones on Twiter. To manage you app you'll need to go to sign in and find the app you're using. Open it and then select the tab 'Permissions'. All application are created in Read-only mode by default so if you haven't accessed this tab before, chances are, your app is read-only. You'll need to authorize a phone number in order to allow you app to have write permissions. After you'v set the permission in the tab 'Keys and Access Tokens' you'll notice that you access token is still for read-only access. You'll need to generate a new-one and then provide Kentico with the new credentials. It should then work.

Let me know how it went ;-)

P.S.: For more detailed information about this here's a link to our documentation dealing with twitter integration in Kentico. It's a Kentico 8.1 documentation. I'm afraid I can't provide you with a link to a version 7 documentation since it isn't online. It could still prove a bit helpful I think.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.