Steps to Get Twitter.module working with Rules:
Required Modules:
Take the following steps:
-
Install a few modules: To start with, install the following modules:
- oAuth
- Twitter Post
- For using Rules (optional)
- Twitter actions
- Token
- Rules
- Rules Administration UI
-
OAuth settings: Visit the oAuth setting page (admin/settings/oauth) and under OAuth cryptography select âRSA-SHA1â and click âSave configurationâ.
-
Register with Twitter: On the Twitter settings page (admin/settings/twitter) you now need to register your application with Twitter (https://twitter.com/apps/new).
- Application Name: a simple name to identify what you are doing.
- Description: Minimum of 10 characters is required.
- Application website: The URL of the website your are registering.
- Organization: Your organization name.
- Website: Your homepage URL.
- Application Type: Browser
- Callback URL: This is provided by the Twitter module (admin/settings/twitter) http://{your_url}/twitter/oauth
- Default Access type: Read & Write
-
Secrets: Once the application has been registered, Twitter will provide you with the Consumer key and Consumer secret. Enter those on the Twitter module settings page back on your site (admin/settings/twitter) and click âSave configurationâ.
-
Post to Twitter (Optional): If you wanting an option to post to Twitter when you add new content to your site, click the âPostâ tab and select the node types you want it to show on as well as set the default format of the post.
-
Setup your account: This next step is critical. Edit your account page and select the sub-tab of âTwitter accountsâ (user//edit/twitter) and click âAdd accountâ. This will take you to the Twitter.com page to authorize and allow access to your account.
- If you want to use the âPost to Twitterâ form at the bottom of the new nodeâs you can make this account global to the site by clicking âmake globalâ. This will not effect the rules module.
-
Time to add a rule (Optional: Rules integration): Go to the âAdd a new ruleâ page (admin/rules/trigger/add), set the name, and set the Event for âAfter saving new contentâ. On the next page, add and action of âPost a message to Twitterâ. On the setting page, enter the Twitter account name that you authorized in step 6. Enter the message that you want to tweet. If you installed the Token module you will be able to add tokens like âNode Titleâ.
-
Watch it work! Now all you need to do is create a new node and it will post a message to the Twitter account you specified.