diff --git a/templates/zerver/integrations/index.html b/templates/zerver/integrations/index.html index 1fb29820e2..d4ac9fffe5 100644 --- a/templates/zerver/integrations/index.html +++ b/templates/zerver/integrations/index.html @@ -115,103 +115,6 @@ {% if email_integration_enabled %} {% include 'zerver/integrations/email.html' %} {% endif %} - - -
- - -

See Twitter search results in Zulip! This is great for seeing and - discussing who is talking about you, friends, competitors, or important - topics in real time.

- -

First, create the stream you'd like to use for tweets, and subscribe - all interested parties to this stream. We recommend the - name twitter.

- -

Next, download and install our Python bindings and - example scripts. This bot should be set up on a trusted machine, - because your API key is visible to local users through the command line or - config file.

- -

Next, install version 1.0 or later of - the twitter-python library. If your operating system - distribution doesn't package a new enough version, you can install the - library from source - from the GitHub - repository.

- -

Next, set up Twitter authentication. This bot uses OAuth to - authenticate with Twitter, and in order to obtain a consumer key & secret, - you must register a new application under your Twitter account:

- -
    -
  1. - Log in to http://dev.twitter.com. -
  2. -
  3. - In the menu under your username, - click My Applications. From - this page, create a new application. -
  4. -
  5. - Click on the application you created and click "create my access - token". Fill in the requested values. -
  6. -
- -

To configure and deploy this bot:

- -
    -
  1. - Create a ~/.zulip_twitterrc with the following - contents: - -
    [twitter]
    -consumer_key =
    -consumer_secret =
    -access_token_key =
    -access_token_secret =
    -
  2. -
  3. - Test the script by running it manually: - -
    -            /usr/local/share/zulip/integrations/twitter/twitter-search-bot --search="@nprnews,quantum physics" --site={{ external_api_uri_subdomain }}
    -
    -          
    - - Note: twitter-search-bot may install to a different - location on your operating system distribution. -
  4. -
  5. - Configure a crontab entry for this script. A sample crontab entry that - will process tweets every minute is: - -
    -            * * * * * /usr/local/share/zulip/integrations/twitter/twitter-search-bot --search="@nprnews,quantum physics" --site={{ external_api_uri_subdomain }}
    -          
    -
  6. -
- -

Congratulations! You're done!
When someone tweets a - message containing one of your search terms, you'll get a Zulip on your - specified stream, with the search term as the topic.

- - - -

Note that the twitter search bot integration just sends - links to tweets; the pretty inline previews of tweets are - generated by the Twitter card rendering integration configured - in /etc/zulip/settings.py on the Zulip server.

- -

- Logos are trademarks of their respective owners. - None of the integrations on this page are created by, - affiliated with, or supported by the companies - represented by the logos. -

- -
diff --git a/templates/zerver/integrations/twitter.html b/templates/zerver/integrations/twitter.html new file mode 100644 index 0000000000..f3c793aa2b --- /dev/null +++ b/templates/zerver/integrations/twitter.html @@ -0,0 +1,92 @@ +

+ See Twitter search results in Zulip! This is great for seeing and + discussing who is talking about you, friends, competitors, or important + topics in real time. +

+ +

+ First, create the stream you'd like to use for tweets, and subscribe + all interested parties to this stream. We recommend the + name twitter. +

+ +

+ Next, download and install our + Python bindings and example scripts. + This bot should be set up on a trusted machine, + because your API key is visible to local users through the command line or + config file. +

+ +

+ Next, install version 1.0 or later of + the twitter-python library. If your operating system + distribution doesn't package a new enough version, you can install the + library from source from + the GitHub repository. +

+ +

+ Next, set up Twitter authentication. This bot uses OAuth to + authenticate with Twitter, and in order to obtain a consumer key & secret, + you must register a new application under your Twitter account: +

+ +
    +
  1. + Log in to http://dev.twitter.com. +
  2. +
  3. + In the menu under your username, + click My Applications. From + this page, create a new application. +
  4. +
  5. + Click on the application you created and click "create my access + token". Fill in the requested values. +
  6. +
+ +

To configure and deploy this bot:

+ +
    +
  1. + Create a ~/.zulip_twitterrc with the following + contents: + +
    [twitter]
    +consumer_key =
    +consumer_secret =
    +access_token_key =
    +access_token_secret =
    +
  2. +
  3. + Test the script by running it manually: + +
    /usr/local/share/zulip/integrations/twitter/twitter-search-bot --search="@nprnews,quantum physics" --site={{ external_api_uri_subdomain }}
    + + Note: twitter-search-bot may install to a different + location on your operating system distribution. +
  4. +
  5. + Configure a crontab entry for this script. A sample crontab entry that + will process tweets every minute is: + +
    * * * * * /usr/local/share/zulip/integrations/twitter/twitter-search-bot --search="@nprnews,quantum physics" --site={{ external_api_uri_subdomain }}
    +
  6. +
+ +

+ Congratulations! You're done!
When someone tweets a + message containing one of your search terms, you'll get a Zulip on your + specified stream, with the search term as the topic. +

+ + + +

+ Note that the twitter search bot integration + just sends links to tweets; the pretty inline previews of tweets are + generated by the Twitter card rendering integration configured + in /etc/zulip/settings.py on the Zulip server. +

diff --git a/tools/check-templates b/tools/check-templates index 382c324809..a2d78c3d53 100755 --- a/tools/check-templates +++ b/tools/check-templates @@ -135,6 +135,7 @@ def check_html_templates(templates, all_dups): 'templates/zerver/integrations/openshift.html', 'templates/zerver/integrations/subversion.html', 'templates/zerver/integrations/trac.html', + 'templates/zerver/integrations/twitter.html', ] validate(fn=fn, check_indent=(fn not in bad_files)) diff --git a/zerver/lib/integrations.py b/zerver/lib/integrations.py index b68174c4ca..572b1bcc27 100644 --- a/zerver/lib/integrations.py +++ b/zerver/lib/integrations.py @@ -237,7 +237,7 @@ INTEGRATIONS = { display_name='Trello', doc='zerver/integrations/trello-plugin.html' ), - 'twitter': Integration('twitter', 'twitter'), + 'twitter': Integration('twitter', 'twitter', doc='zerver/integrations/twitter.html'), } # type: Dict[str, Integration]