mirror of
https://github.com/zulip/zulip.git
synced 2026-06-18 21:01:52 +08:00
integrations doc: Move twitter doc to separate file.
This commit is contained in:
parent
1b6cdb92b7
commit
a8633e0975
@ -115,103 +115,6 @@
|
||||
{% if email_integration_enabled %}
|
||||
{% include 'zerver/integrations/email.html' %}
|
||||
{% endif %}
|
||||
|
||||
|
||||
<div id="twitter" class="integration-instructions">
|
||||
|
||||
|
||||
<p>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.</p>
|
||||
|
||||
<p>First, create the stream you'd like to use for tweets, and subscribe
|
||||
all interested parties to this stream. We recommend the
|
||||
name <code>twitter</code>.</p>
|
||||
|
||||
<p>Next, download and install our <a href="/api">Python bindings and
|
||||
example scripts</a>. 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.</p>
|
||||
|
||||
<p>Next, install <b>version 1.0 or later</b> of
|
||||
the <code>twitter-python</code> library. If your operating system
|
||||
distribution doesn't package a new enough version, you can install the
|
||||
library from source
|
||||
from <a href="https://github.com/bear/python-twitter">the GitHub
|
||||
repository</a>.</p>
|
||||
|
||||
<p>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:</p>
|
||||
|
||||
<ol>
|
||||
<li>
|
||||
Log in to <a href="http://dev.twitter.com">http://dev.twitter.com</a>.
|
||||
</li>
|
||||
<li>
|
||||
In the menu under your username,
|
||||
click <a href="https://dev.twitter.com/apps">My Applications</a>. From
|
||||
this page, create a new application.
|
||||
</li>
|
||||
<li>
|
||||
Click on the application you created and click "create my access
|
||||
token". Fill in the requested values.
|
||||
</li>
|
||||
</ol>
|
||||
|
||||
<p>To configure and deploy this bot:</p>
|
||||
|
||||
<ol>
|
||||
<li>
|
||||
Create a <code>~/.zulip_twitterrc</code> with the following
|
||||
contents:
|
||||
|
||||
<pre>[twitter]
|
||||
consumer_key =
|
||||
consumer_secret =
|
||||
access_token_key =
|
||||
access_token_secret =</pre>
|
||||
</li>
|
||||
<li>
|
||||
Test the script by running it manually:
|
||||
|
||||
<pre>
|
||||
/usr/local/share/zulip/integrations/twitter/twitter-search-bot --search="@nprnews,quantum physics" --site={{ external_api_uri_subdomain }}
|
||||
|
||||
</pre>
|
||||
|
||||
Note: <code>twitter-search-bot</code> may install to a different
|
||||
location on your operating system distribution.
|
||||
</li>
|
||||
<li>
|
||||
Configure a crontab entry for this script. A sample crontab entry that
|
||||
will process tweets every minute is:
|
||||
|
||||
<pre>
|
||||
* * * * * /usr/local/share/zulip/integrations/twitter/twitter-search-bot --search="@nprnews,quantum physics" --site={{ external_api_uri_subdomain }}
|
||||
</pre>
|
||||
</li>
|
||||
</ol>
|
||||
|
||||
<p><b>Congratulations! You're done!</b><br /> 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.</p>
|
||||
|
||||
<img class="screenshot" src="/static/images/integrations/twitter/001.png" />
|
||||
|
||||
<p>Note that the twitter search bot integration <b>just sends
|
||||
links to tweets</b>; the pretty inline previews of tweets are
|
||||
generated by the Twitter card rendering integration configured
|
||||
in <code>/etc/zulip/settings.py</code> on the Zulip server.</p>
|
||||
|
||||
<p style="font-size:11px; font-style:italic;">
|
||||
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.
|
||||
</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- .inner-content -->
|
||||
</div> <!-- .padded-content -->
|
||||
|
||||
92
templates/zerver/integrations/twitter.html
Normal file
92
templates/zerver/integrations/twitter.html
Normal file
@ -0,0 +1,92 @@
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
First, create the stream you'd like to use for tweets, and subscribe
|
||||
all interested parties to this stream. We recommend the
|
||||
name <code>twitter</code>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Next, download and install our
|
||||
<a href="/api">Python bindings and example scripts</a>.
|
||||
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.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Next, install <b>version 1.0 or later</b> of
|
||||
the <code>twitter-python</code> library. If your operating system
|
||||
distribution doesn't package a new enough version, you can install the
|
||||
library from source from
|
||||
<a href="https://github.com/bear/python-twitter">the GitHub repository</a>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
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:
|
||||
</p>
|
||||
|
||||
<ol>
|
||||
<li>
|
||||
Log in to <a href="http://dev.twitter.com">http://dev.twitter.com</a>.
|
||||
</li>
|
||||
<li>
|
||||
In the menu under your username,
|
||||
click <a href="https://dev.twitter.com/apps">My Applications</a>. From
|
||||
this page, create a new application.
|
||||
</li>
|
||||
<li>
|
||||
Click on the application you created and click "create my access
|
||||
token". Fill in the requested values.
|
||||
</li>
|
||||
</ol>
|
||||
|
||||
<p>To configure and deploy this bot:</p>
|
||||
|
||||
<ol>
|
||||
<li>
|
||||
Create a <code>~/.zulip_twitterrc</code> with the following
|
||||
contents:
|
||||
|
||||
<pre>[twitter]
|
||||
consumer_key =
|
||||
consumer_secret =
|
||||
access_token_key =
|
||||
access_token_secret =</pre>
|
||||
</li>
|
||||
<li>
|
||||
Test the script by running it manually:
|
||||
|
||||
<pre>/usr/local/share/zulip/integrations/twitter/twitter-search-bot --search="@nprnews,quantum physics" --site={{ external_api_uri_subdomain }}</pre>
|
||||
|
||||
Note: <code>twitter-search-bot</code> may install to a different
|
||||
location on your operating system distribution.
|
||||
</li>
|
||||
<li>
|
||||
Configure a crontab entry for this script. A sample crontab entry that
|
||||
will process tweets every minute is:
|
||||
|
||||
<pre>* * * * * /usr/local/share/zulip/integrations/twitter/twitter-search-bot --search="@nprnews,quantum physics" --site={{ external_api_uri_subdomain }}</pre>
|
||||
</li>
|
||||
</ol>
|
||||
|
||||
<p>
|
||||
<b>Congratulations! You're done!</b><br/> 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.
|
||||
</p>
|
||||
|
||||
<img class="screenshot" src="/static/images/integrations/twitter/001.png"/>
|
||||
|
||||
<p>
|
||||
Note that the twitter search bot integration
|
||||
<b>just sends links to tweets</b>; the pretty inline previews of tweets are
|
||||
generated by the Twitter card rendering integration configured
|
||||
in <code>/etc/zulip/settings.py</code> on the Zulip server.
|
||||
</p>
|
||||
@ -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))
|
||||
|
||||
|
||||
@ -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]
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user