Bot problems

bots

#1

hello,
i made an ebook bot(randomization bot) and i managed to get all the code right but i have been getting this problem when i run the bot where it basically says that there are problems with the authentication of the twitter.api. My access tokens are put in correctly. Does anyone know what the problem could be??


#2

What’s the exact error message and API endpoint you’re using? Are you sure your access tokens have the right permissions? (Read & Write if you’re tweeting)

Also, it’s a good idea to make sure your bot is easily identifiable as a bot, in your Twitter Name with a :robot: emoji (it seems to be a popular convention) and in your description, pointing to the owner (your own account) there’s a lot of good advice on https://botwiki.org/ in case you haven’t come across that yet.


#3

File “ebooks.py”, line 158, in
handle_stats = api.GetUser(screen_name=user)
File “/app/.heroku/python/lib/python3.6/site-packages/twitter/api.py”, line 2868, in GetUser
resp = self._RequestUrl(url, ‘GET’, data=parameters)
File “/app/.heroku/python/lib/python3.6/site-packages/twitter/api.py”, line 4959, in _RequestUrl
raise TwitterError(“The twitter.Api instance must be authenticated.”)
twitter.error.TwitterError: The twitter.Api instance must be authenticated.
That’s the message error it gives me. And I have read and write permission activated.
And I dont know how changing the name and description can fix it but that might just be my naivete. Thanks


#4

Looks like something is going wrong in how you’re authenticating - i can’t really tell what exactly

Are you using https://github.com/tommeagher/heroku_ebooks/blob/master/ebooks.py by any chance?

If you are, a common error is replacing “MY_CONSUMER_KEY” etc in the code, rather than setting up environment variable properly.

(Changing the name and description of your bot has nothing to do with your error but is generally good practice)


#5

i am using that github. how do i set up the environment variable properly?


#6

It really depends on what the code is running on, and how and where you’re deploying it (your laptop, heroku, something else)

Make sure you’re following https://github.com/tommeagher/heroku_ebooks/blob/master/README.md

It might be faster to get help in the botmaker https://botmakers.org/ slack or in the git repo Issues!