Differences between revisions 18 and 37 (spanning 19 versions)
Revision 18 as of 2012-12-28 22:15:54
Size: 8395
Editor: vhe-430059
Comment: Added information on how to enable streaming timeline support
Revision 37 as of 2019-12-26 23:07:24
Size: 10734
Editor: 2001:67c:5c:505:3c0b:2e0b:c577:bd8
Comment:
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
Since version 1.2.6, BitlBee has native support for Twitter via the Twitter API. Since 1.2.7, it uses OAuth authentication for this, as the Twitter.com API has stopped accepting HTTP-Basic authentication.

To use your Twitter account in BitlBee:

{{{#!irc
11:45:03 <wilmer> account add twitter BitlBee foo
{{{#!wiki caution
'''Streams will be shut down on 2018-08-16'''

This will break bitlbee with the default settings, but it can work (with caveats) if you disable the `stream` setting.

We have a [[HowtoTwitter/StreamDeprecation|separate page on this topic]], go read it.
}}}

!BitlBee has native support for Twitter via the Twitter API.

You '''need''' to use '''!BitlBee 3.2.1''' (or newer) due to server side api changes. None of the previously mentioned workarounds are effective anymore.

If you're stuck with 3.0 or 3.2 in a debian based distro, there's a repository at http://code.bitlbee.org/debian/.

== Connecting ==

To use your Twitter account in !BitlBee:

{{{#!irc
11:45:03 <wilmer> account add twitter <yourusername>
Line 12: Line 26:
11:45:06 <root> twitter(BitlBee) - Logging in: Requesting OAuth request token
}}}

Since you're using OAuth, you don't have to enter your actual Twitter password at this point. Since BitlBee requires a password to be entered for every account, just type something bogus here (like ''foo'' in this example).

This will start up OAuth authentication. Soon, you will receive a message from twitter_''yourusername'':

{{{#!irc
11:45:07 <twitter_bitlbee> To finish OAuth authentication, please visit http://api.twitter.com/oauth/authorize?oauth_token=xxxxxxxxx and respond with the resulting PIN code.
11:45:06 <root> twitter - Logging in: Requesting OAuth request token
}}}

Since you're using OAuth, you don't have to enter your actual Twitter password at this point.

This will start up OAuth authentication. Soon, you will receive a private message from twitter_''yourusername'':

{{{#!irc
11:45:07 <twitter_yourusername> To finish OAuth authentication, please visit http://api.twitter.com/oauth/authorize?oauth_token=xxxxxxxxx and respond with the resulting PIN code.
Line 30: Line 44:
11:59:54 <root> twitter(BitlBee) - Logging in: Connecting to Twitter
11:59:55 <root> twitter(BitlBee) - Logging in: Logged in
11:59:54 <root> twitter - Logging in: Connecting to Twitter
11:59:55 <root> twitter - Logging in: Logged in
Line 36: Line 50:
This OAuth-based authentication "dance" has to be done only once. At the end of the process, Twitter gives BitlBee a permanent authentication token, which will be saved in your configuration. This OAuth-based authentication "dance" has to be done only once. At the end of the process, Twitter gives !BitlBee a permanent authentication token, which will be saved in your configuration.
Line 43: Line 57:
12:05:13 <root> 13. twitter, BitlBee (connected) 12:05:13 <root> 13 (twitter): twitter, yourusername (connected)
Line 45: Line 59:
12:05:18 <wilmer> account off twitter(BitlBee)
12:05:18 <root> twitter(BitlBee) - Signing off..
12:05:26 <wilmer> account set 13/mode chat
12:05:18 <wilmer> account twitter off
12:05:18 <root> twitter - Signing off..
12:05:26 <wilmer> account twitter set mode chat
Line 49: Line 63:
12:05:28 <wilmer> account on 13
12:05:28 <root> twitter(BitlBee) - Logging in: Connecting to Twitter
12:05:29 <root> twitter(BitlBee) - Logging in: Logged in
12:05:28 <wilmer> account twitter on
12:05:28 <root> twitter - Logging in: Connecting to Twitter
12:05:29 <root> twitter - Logging in: Logged in
Line 70: Line 84:
To start following someone (this appeared in 1.2.8):
{{{
add 13 twitter_username_to_follow
}}}
(where 13 is the account_id for your twitter account in bitlbee. You can find account_id using 'account list' command)

Right now, there's no way to unfollow/
block a twitter user using bitlbee. Moreover, there's no support for twitter 'lists' or keyword searches as of yet in bitlbee.

== Replies, retweets, etc. ==

In very new versions (released/checked out after 2010-08-08), you can retweet and reply to messages. See `help set commands` and `help set auto_reply_timeout` for more information.
To start following someone:
{{{
add twitter twitter_username_to_follow
}}}

Likewise, you can use `unfollow` to unfollow someone.

Ri
ght now, there's no way to block a twitter user using bitlbee. Moreover, there's no support for twitter 'lists' or keyword searches as of yet in bitlbee.

== Replies, retweets, direct messages etc. ==

You can retweet and reply to messages with !BitlBee. See `help set commands` and `help set auto_reply_timeout` for more information.
Line 84: Line 99:
If you want to be able to retweet/reply to older messages regularly, it's a good idea to enable the '''show_ids''' setting (very recent feature, not yet available in 3.0.2!), which will assign two-digit IDs to all messages, like this: If you want to be able to retweet/reply to older messages regularly, it's a good idea to enable the '''show_ids''' setting, which will assign two-digit IDs to all messages, like this:
Line 94: Line 109:
== Streaming your timeline ==

Since Bitlbee switched to Twitter's new JSON-based API (note: not in 3.0.6 yet!), it supports streaming the timeline as opposed to polling it every minute. To enable this, you need to enable the 'stream' setting. You can achieve this by doing the following:
{{{#!irc
[23:13:15] <@Aaron> account 0 off
[23:13:15] <@root> twitter - Signing off..
[23:13:21] <@Aaron> account 0 set stream on
[23:13:21] <@root> stream = `on'
[23:13:23] <@Aaron> account 0 on
[23:13:23] <@root> twitter - Logging in: Connecting
}}}
To message one of your followers directly (DM / direct messages), use: /msg user message.
Line 108: Line 113:
If you prefer, you can put Bitlbee in command mode to make every action explicit, preventing the accidental tweet if you make a typo. To set Twitter to command mode, set the '''commands''' setting to 'strict'. Note that it is set to 'on' by default. (NB: strict mode is a new feature, it is not yet available in 3.0.6!) If you prefer, you can put Bitlbee in command mode to make every action explicit, preventing the accidental tweet if you make a typo. To set Twitter to command mode, set the '''commands''' setting to 'strict'. These are the possible values:

 * '''strict''': command mode. Commands acted on as documented below. Non-commands give an error.
 * '''off''' or '''false''': post mode. Everything is treated as a post, even commands.
 * '''on''' or '''true''': mixed mode. Commands acted on as documented below. Non-commands treated as tweets. (default setting)

To do this, make sure you are in &bitlbee, and run `account <num> set commands strict`, where <num> is the id of your Twitter account. `account <num> set` will list the current configuration for that account.
Line 111: Line 122:
 * '''post''': Send the text following the command as a new tweet. (NB: this command is not yet available in 3.0.6!)  * '''post''': Send the text following the command as a new tweet.
Line 119: Line 130:
 * '''url''' [id]: Show Twitter URL for tweet ID provided.

{{{#!wiki note
There's a patch to add a help command to explain the above here: http://bugs.bitlbee.org/bitlbee/ticket/1182
}}}

== Filter channels ==

Since BitlBee 3.4, you can add twitter filter channels

This allows you to track keywords or hashtags and/or read the tweets of select users without actually following them. A filter group chat can have multiple users, keywords, or hashtags.

'''Limitations:''' Do not use the ''reply'' command in a filter channel. The msg id will be taken as a msg id from your main timeline, which will be the wrong message.

=== Creating a new filter channel ===

To create a filter channel, follow this format:

{{{
chat add twitter <search> <channel>
}}}

Where:

 * {{{<channel>}}} is the channel name you want to add
 * And {{{<search>}}} is a semicolon-separated combination of {{{follow:username}}} and/or {{{track:keyword}}} (or {{{track:#hashtag}}})

And then /join that channel.

=== Modifying a tracking channel ===

If you want to edit the search query used by a filter channel, do:

{{{
channel <channel> set room <new value>
}}}

=== Examples ===

 * A channel with only the twitter user @bitlbee in it

{{{
chat add twitter follow:bitlbee #filterchannel
}}}

 * A channel that shows every mention of the word "bitlbee"

{{{
chat add twitter track:bitlbee #filterchannel
}}}

 * A channel that follows two bots that post messages every two minutes:

{{{
chat add twitter follow:metaphorminute;follow:RealHumanPraise #filterchannel
}}}

 * A channel that tracks a moderately spammy hashtag:

{{{
chat add twitter track:#giveaway #filterchannel
}}}

 * A channel that combines a follow for @metaphorminute and tracking for "#giveaway"

{{{
chat add twitter follow:metaphorminute;track:#giveaway #filterchannel
}}}
Line 121: Line 200:

=== 401 Unauthorized ===
Line 132: Line 213:
Also, check your !BitlBee version. Versions older than 3.0.3 won't work because Twitter recently deprecated some API calls used by old !BitlBee versions. There's a workaround available ({{{account twitter set base_url http://api.twitter.com/1}}}) but upgrading to 3.0.3 is recommended. === 403 Forbidden ===

Since 21 nov 2013 twitter does not allow HTTP/1.0 for user streams. And since 14 jan 2014, it doesn't allow unencrypted traffic. As a result, !BitlBee 3.2 will not be able to connect at all.

{{{
twitter - Logging in: Getting contact list
twitter - Login error: Could not retrieve /friends/ids.xml: 403 Forbidden
twitter - Logging in: Signing off..
}}}

There are no workarounds for this error message, the only solution is to upgrade to !BitlBee 3.2.1.

=== Other errors ===

Check your !BitlBee version. Versions older than 3.2.1 won't work because Twitter removed the API calls used by old !BitlBee versions.

Setting up a Twitter account in BitlBee

Streams will be shut down on 2018-08-16

This will break bitlbee with the default settings, but it can work (with caveats) if you disable the stream setting.

We have a separate page on this topic, go read it.

BitlBee has native support for Twitter via the Twitter API.

You need to use BitlBee 3.2.1 (or newer) due to server side api changes. None of the previously mentioned workarounds are effective anymore.

If you're stuck with 3.0 or 3.2 in a debian based distro, there's a repository at http://code.bitlbee.org/debian/.

Connecting

To use your Twitter account in BitlBee:

   1 11:45:03 <wilmer> account add twitter <yourusername>
   2 11:45:03 <root> Account successfully added
   3 11:45:06 <wilmer> account on
   4 11:45:06 <root> Trying to get all accounts connected...
   5 11:45:06 <root> twitter - Logging in: Requesting OAuth request token

Since you're using OAuth, you don't have to enter your actual Twitter password at this point.

This will start up OAuth authentication. Soon, you will receive a private message from twitter_yourusername:

   1 11:45:07 <twitter_yourusername> To finish OAuth authentication, please visit http://api.twitter.com/oauth/authorize?oauth_token=xxxxxxxxx and respond with the resulting PIN code.

Open this link in your web browser and you will get something like this:

twitter_oauth.png

Or if you're not logged into Twitter yet in that browser, it will let you do that first. Once you click on Allow here, Twitter will show you a seven-digit password. In your IRC window with twitter_yourusername, just respond with this password (and nothing else on the line, just the password!) to finish the login process. If everything goes well:

   1 11:59:54 <root> twitter - Logging in: Connecting to Twitter
   2 11:59:55 <root> twitter - Logging in: Logged in

And you will now get all tweets from yourself and the people you follow in the twitter_yourusername query window. (Note that you can use the rename command to change this nick into something else, for example to just "Twitter".) If you want to send tweets yourself, any message sent to this user will be posted as a tweet.

This OAuth-based authentication "dance" has to be done only once. At the end of the process, Twitter gives BitlBee a permanent authentication token, which will be saved in your configuration.

If you'd like to get your Tweets in something that looks more like an IRC channel instead of everything in one query window, you can use the mode account setting. To enable it, you have to log out, change the setting and log back in:

   1 12:05:13 <wilmer> account list
   2 12:05:13 <root> ...
   3 12:05:13 <root> 13 (twitter): twitter, yourusername (connected)
   4 12:05:13 <root> End of account list
   5 12:05:18 <wilmer> account twitter off
   6 12:05:18 <root> twitter - Signing off..
   7 12:05:26 <wilmer> account twitter set mode chat
   8 12:05:26 <root> mode = `chat'
   9 12:05:28 <wilmer> account twitter on
  10 12:05:28 <root> twitter - Logging in: Connecting to Twitter
  11 12:05:29 <root> twitter - Logging in: Logged in

And in a new channel window you'll get all your Twitter stuff:

   1 12:05:29     -!-     Irssi: &twitter_bitlbee: Total of 22 nicks [1 ops, 0 halfops, 10 voices, 11 normal]
   2 12:05:29     -!-     Topic for &twitter_bitlbee: BitlBee groupchat: "home/timeline". Please keep in mind that root-commands won't work here. Have fun!
   3 12:05:29     -!-     Topic set by root [root@testbee.bitlbee.org] [Sat May 22 12:05:29 2010]
   4 12:05:29 <root> Your Tweet: Some people *may* be having troubles with testing.bitlbee.org because of apparent network problems @ London Internet Exchange.
   5 12:05:29 <root> Your Tweet: BitlBee 1.2.5 is finally ready, with full support for status messages and better support for Facebook chat! http://bit.ly/d62AUF
   6 12:05:29 <root> Your Tweet: BitlBee with native Twitter support: http://code.bitlbee.org/contrib/geert-twitter/ will be merged into mainline soon.

In this mode, you can also send messages by just writing in the IRC channel.

Using Twitter inside BitlBee

Now that you have twitter up and running inside bitlbee, you'll probably want to follow/unfollow users on twitter etc.

To start following someone:

add twitter twitter_username_to_follow

Likewise, you can use unfollow to unfollow someone.

Right now, there's no way to block a twitter user using bitlbee. Moreover, there's no support for twitter 'lists' or keyword searches as of yet in bitlbee.

Replies, retweets, direct messages etc.

You can retweet and reply to messages with BitlBee. See help set commands and help set auto_reply_timeout for more information.

In short, usually just replying to people the way you normally do on IRC should be converted into a reply to the person's last message. Retweets can be done by doing rt <screenname> in your Twitter window.

If you want to be able to retweet/reply to older messages regularly, it's a good idea to enable the show_ids setting, which will assign two-digit IDs to all messages, like this:

   1 11:19 <root> You: [97] Like being unable to buy laptops without Windows isn't enough,turns out removing the stupid license sticker is also really hard. Fuck you,MS
   2 11:25 <frlinux> [98->97] @wilmer my users make a decent job at scratching and making all serial stickers unreadable after 2 years...
   3 11:31 <frlinux> [00] ...
   4 11:40 <wilmer> reply 98 Heh, in fact mine was already quite unreadable already yeah, in just over one year. Should've removed it earlier..
   5 11:40 <root> You: [03->98] @frlinux Heh, in fact mine was already quite unreadable already yeah, in just over one year. Should've removed it earlier..

To message one of your followers directly (DM / direct messages), use: /msg user message.

(Strict) command mode

If you prefer, you can put Bitlbee in command mode to make every action explicit, preventing the accidental tweet if you make a typo. To set Twitter to command mode, set the commands setting to 'strict'. These are the possible values:

  • strict: command mode. Commands acted on as documented below. Non-commands give an error.

  • off or false: post mode. Everything is treated as a post, even commands.

  • on or true: mixed mode. Commands acted on as documented below. Non-commands treated as tweets. (default setting)

To do this, make sure you are in &bitlbee, and run account <num> set commands strict, where <num> is the id of your Twitter account. account <num> set will list the current configuration for that account.

In strict command mode, the following commands are supported:

  • post: Send the text following the command as a new tweet.

  • undo [id]: Undo last action or the action of the id provided (i.e. a tweet you posted).

  • favourite [id|username]: Favourite the tweet belonging to the id or username provided.

  • follow [username]: Start following the provided username.

  • unfollow [username]: Stop following the provided username.

  • report or spam [username|id]: Report the provided username for spam (will be looked up if a status id is provided)

  • rt [id|username]: Retweet tweet with status id provided, or last tweet by the username provided.

  • reply [id|username]: Reply to tweet with status id provided, or last tweet by the username provided.

  • url [id]: Show Twitter URL for tweet ID provided.

There's a patch to add a help command to explain the above here: http://bugs.bitlbee.org/bitlbee/ticket/1182

Filter channels

Since BitlBee 3.4, you can add twitter filter channels

This allows you to track keywords or hashtags and/or read the tweets of select users without actually following them. A filter group chat can have multiple users, keywords, or hashtags.

Limitations: Do not use the reply command in a filter channel. The msg id will be taken as a msg id from your main timeline, which will be the wrong message.

Creating a new filter channel

To create a filter channel, follow this format:

chat add twitter <search> <channel>

Where:

  • <channel> is the channel name you want to add

  • And <search> is a semicolon-separated combination of follow:username and/or track:keyword (or track:#hashtag)

And then /join that channel.

Modifying a tracking channel

If you want to edit the search query used by a filter channel, do:

channel <channel> set room <new value>

Examples

  • A channel with only the twitter user @bitlbee in it

chat add twitter follow:bitlbee #filterchannel
  • A channel that shows every mention of the word "bitlbee"

chat add twitter track:bitlbee #filterchannel
  • A channel that follows two bots that post messages every two minutes:

chat add twitter follow:metaphorminute;follow:RealHumanPraise #filterchannel
  • A channel that tracks a moderately spammy hashtag:

chat add twitter track:#giveaway #filterchannel
  • A channel that combines a follow for @metaphorminute and tracking for "#giveaway"

chat add twitter follow:metaphorminute;track:#giveaway #filterchannel

Common Issues

401 Unauthorized

Commonly, when attempting to login, twitter will respond with the following:

twitter - Logging in: Connecting
twitter - Logging in: Requesting OAuth request token
twitter - Couldn't log in: OAuth error: 401 Unauthorized
twitter - Logging in: Signing off..

Most often, when this error occurs, it means that the system clock is too far off from Twitter's own concept of what the time is. Installing 'ntp' on the system will help ensure that the system's clock stays accurate enough for Twitter.

403 Forbidden

Since 21 nov 2013 twitter does not allow HTTP/1.0 for user streams. And since 14 jan 2014, it doesn't allow unencrypted traffic. As a result, BitlBee 3.2 will not be able to connect at all.

twitter - Logging in: Getting contact list
twitter - Login error: Could not retrieve /friends/ids.xml: 403 Forbidden
twitter - Logging in: Signing off..

There are no workarounds for this error message, the only solution is to upgrade to BitlBee 3.2.1.

Other errors

Check your BitlBee version. Versions older than 3.2.1 won't work because Twitter removed the API calls used by old BitlBee versions.

BitlBee Wiki: HowtoTwitter (last edited 2019-12-26 23:07:24 by 2001:67c:5c:505:3c0b:2e0b:c577:bd8)