Software /
code /
prosody-modules
Comparison
mod_tweet_data/README.md @ 4597:c858c76d0845
mod_tweet_data: New module that fetches and sends tweet data
based on tweet URLs in MUC messages.
author | JC Brand <jc@opkode.com> |
---|---|
date | Tue, 22 Jun 2021 11:41:16 +0200 |
comparison
equal
deleted
inserted
replaced
4596:c406e4bf7ee5 | 4597:c858c76d0845 |
---|---|
1 # mod_tweet_data | |
2 | |
3 This module adds [Open Graph Protocol](https://ogp.me) metadata to Twitter.com tweet URLs sent inside a MUC. | |
4 | |
5 It's similar to [mod_ogp](https://modules.prosody.im/mod_ogp.html) but is adapted specifically to Twitter.com, which doesn't support the [Open Graph Protocol](https://ogp.me). | |
6 | |
7 When a user sends a tweet URL in a MUC (where the message has its `id` equal to its `origin-id`), this module calls that URL to get the tweet data. | |
8 If it finds any, it sends a [XEP-0422 fastening](https://xmpp.org/extensions/xep-0422.html) applied to the original message that looks as follows (note, I haven't used real data here): | |
9 | |
10 ```xml | |
11 <message xmlns="jabber:client" to="user@chat.example.org/resource" from="chatroom@muc.example.org" type="groupchat"> | |
12 <apply-to xmlns="urn:xmpp:fasten:0" id="82dbc94c-c18a-4e51-a0d5-9fd3a7bfd267"> | |
13 <meta xmlns="http://www.w3.org/1999/xhtml" property="og:article:author" content="TwitterCritter" /> | |
14 <meta xmlns="http://www.w3.org/1999/xhtml" property="og:article:published_time" content="2021-06-22T06:44:20.000Z" /> | |
15 <meta xmlns="http://www.w3.org/1999/xhtml" property="og:description" content="I'm in ur twitterz" /> | |
16 <meta xmlns="http://www.w3.org/1999/xhtml" property="og:image" content="https://pbs.twimg.com/profile_images/984325764849045505/Ty3F93Ln_normal.jpg" /> | |
17 <meta xmlns="http://www.w3.org/1999/xhtml" property="og:title" content="TwitterCritter" /> | |
18 <meta xmlns="http://www.w3.org/1999/xhtml" property="og:type" content="tweet" /> | |
19 <meta xmlns="http://www.w3.org/1999/xhtml" property="og:url" content="https://twitter.com/TwitterCritter/status/1407227938391707648" /> | |
20 </apply-to> | |
21 <stanza-id xmlns="urn:xmpp:sid:0" by="chatroom@muc.example.org" id="90e8818d-390a-4c69-a2d8-0fd463fb3366"/> | |
22 </message> | |
23 ``` | |
24 | |
25 Configuration | |
26 ------------- | |
27 | |
28 You'll need to provide a Twitter APIv2 bearer token. | |
29 | |
30 ```lua | |
31 Component "muc.example.org" "muc" | |
32 modules_enabled = { "tweet_data" } | |
33 twitter_apiv2_bearer_token = { "some-very-long-string" } | |
34 ``` |