-
Notifications
You must be signed in to change notification settings - Fork 0
Twitterbot Set Up
#Steps To Set Up Your TwitterBot
- Set up Program O on your server
- Make sure that you have followed the instructions here: https://github.com/Program-O/Program-O/wiki/Installation-Guide
- Create a Twitter account for your chatbot at http://twitter.com
- Sign into your new chatbot Twitter account and follow the Twitter instructions to set up your account
- Set your profile, add a picture etc etc.
- Goto https://apps.twitter.com/
- Click "Create New App"
- Follow the screenshots below to create your Twitter keys;
Note: You do not need a callback or login permissions
note: Press 'create access tokens' to generate your tokens
note: Make sure the access level is set to read/write
note: Change the level if needed to read/write
4.Make a note of ...
- Consumer key
- Consumer secret
- Access token
- Access token secret
-
Open /gui/twitter/tweet.php
-
Locate 'EDIT YOUR CHAT BOT PARAMS'
-
$chatbot_endpoint - Enter the url to your chatbot conversation endpoint - this is normally http://<yoursite.com>/chatbot/conversation_start.php
-
$bot_id - Enter your chatbot bot_id - this is the bot_id from the bots table
-
Locate 'EDIT THE AGE LIMIT OF TWEETS TO REPLY TO (minutes)'
-
$age_of_tweets_in_minutes - add the number of minutes to check for new tweets. e.g. if you enter 5 when your twitterbot runs it will respond to tweets which are no older than 5 minutes old.
-
Locate 'EDIT TWITTER OAUTH PARAMS'
-
Enter the keys you created on apps.twitter.com
- You will need to set up a cron task to run tweet.php every 5 minutes - instructions here: http://askubuntu.com/questions/2368/how-do-i-set-up-a-cron-job
- Your cron job will look something like this php -q /home/yoursite/public_html/yourbot/gui/twitter/tweet.php
The script will run every 5 mins and look for new @mentions created in the last $age_of_tweets_in_minutes on twitter and reply to them.
If you have set up your Twitterbot correctly you can test it by
- Tweet your bot from another account
- Run tweet.php in the browser e.g. http://yoursite.com/chatbot/gui/twitter/tweet.php
If you change the cron occurrence entry in the cron table you will have alter the cron_every_x_minutes value below, so that the minutes are the same.