How to frequently post tweets on behalf of our customer

oauth
php

#1

Hello every one,

I want to post frequently tweets on behalf of my website customers. I have already oauth_token and oauth_token_secret for users.
My code:

$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, USER_OAUTH_TOKEN, USER_OAUTH_TOKEN_SECRET);
$connection->post(‘statuses/update’, array(‘status’ => “tweeting for users”))

Best Regards.


#2

Does that code not work for you? What is the issue you are seeing?

Be aware of our automation rules, and also that each Twitter account is limited to the number of Tweets that can be posted in a day / period of time.


#3

Hello,

Thanks, I have first user send to authorization for my app dann I have stored oAuth tokens from user in data base. Few days after I want to post a tweet on behalf of user and I get an error 220 Your credentials do not allow access to this resource.

Best Regards

Malik


#4

OK, in that case you may want to reauthorise the user and get a new token.


#5

Did you mean that I should again take the user to twitter authorization screen for reauthorize?


#6

Yes, if the token has expired.


#7

What is meant by token is expired. Are you talking about the token of user which are saved in database ?


#8

when I authorize the user and save the oAuth_token and oAuth_token_secret in database than how can I test whether the Token is expired?


#9

@andypiper Please reply.


How to avoid authorization every time posting a tweet
#10

Well, the tokens should not expire unless the user revokes them in their account settings. If there’s a problem with Tweeting you may need to prompt the user to reauthenticate with your service in some way.


#11

My application get access for all the levels provided by Twitter eg read , write and post. I save both oAuth token and secret. Now when I want to post a tweet after 2 days it throws an error 220.

I am in testing phase and i have another twitter account for testing so I am sure the revoke didn’t take place.

Please advise.

Best Regards


#12

Good Morning @andypiper

Is there any update for me ?

Best Regards


#13

In that case it could be that our antispam systems are restricting your use of the API. What are the formats of your Tweets? Are you following the automation rules?


#14

For Testing I am using a “test 2016-08-08 10:16:33” and timestamp is updated on every tweet. But in future we are sending some tweets about user status on our website.

Best Regards


#15

Good Morning @andypiper

Is there any update for me ?

Best Regards


#16

As mentioned, this could be as a result of the antispam system detecting automated behaviour. Apart from that, I don’t know what else to suggest.


#17

:worried: