Git Product home page Git Product logo

Comments (19)

Sorunome avatar Sorunome commented on July 19, 2024 1

I still need to set up my homeserver for federation, and then I will get on!

Looking forward to seeing you there!

Would these be welcome additions to this repo, or do you think it would be better to pursue as its own project?

Yes, such additions would be awesome!

from mx-puppet-twitter.

Sorunome avatar Sorunome commented on July 19, 2024

Heya! Sorry for the lack of install instructions.

You'll need to generate a config.yaml similar to the discord bridge, there are additional keys:

twitter:
  consumerKey: ""
  consumerSecret: ""
  accessToken: ""
  accessTokenSecret: ""
  environment: ""
  server:
    url: # public facing url
    host: # bind host
    port: # bind port

just make sure that the url is proxied to that host/port

from mx-puppet-twitter.

Sorunome avatar Sorunome commented on July 19, 2024

And there is a docker here: https://hub.docker.com/repository/docker/sorunome/mx-puppet-twitter

from mx-puppet-twitter.

cvincent avatar cvincent commented on July 19, 2024

Thanks for the info! I created the config and ran the Docker container which gave me a twitter-registration.yaml. I modified that file with the correct address, copied it to my homeserver, and updated the homeserver.yaml with the Twitter registration.

From here I'm not sure what to do next. The logs for the mx-puppet-twitter container show it setting up a SQLite database but then UnhandledPromiseRejectionWarning: Error: Forbidden.. My guess is it's having trouble connecting with Twitter, but I've double-checked that my Twitter app tokens are correct in the config.yaml. Perhaps my Twitter app needs to set a particular callback URL?

I've also tried starting a chat with @_twitterpuppet_bot:myhomeserver.net in case the error didn't matter. The bot never joins (assuming I got its name right), and the Synapse logs indicate it's getting 404 errors back from mx-puppet-twitter.

I feel like I'm very close to having this working! Any advice, or any additional information you'd like from me?

from mx-puppet-twitter.

Sorunome avatar Sorunome commented on July 19, 2024

What's the log output?

Do you reverse-proxy that twitter.server.url to twitter.server.host:twitter.server.port? That is needed to get webhooks to work

from mx-puppet-twitter.

cvincent avatar cvincent commented on July 19, 2024

The puppet is running on the same box as Synapse as well as another puppet. The port is exposed and Synapse should be able to access it.

Here's the log output for the Docker container:

Jan-13 02:28:06.259 [Store] info: Starting DB Init
Jan-13 02:28:06.262 [Store] info: Filename present in config, using sqlite
Jan-13 02:28:06.262 [SQLite3] info: Opening database.db
Jan-13 02:28:06.266 [Store] warn: Couldn't fetch schema version, defaulting to 0
Jan-13 02:28:06.266 [Store] info: Database schema version is 0, latest version is 6
Jan-13 02:28:06.266 [Store] info: Updating database to v1, "Schema, Userstore, Roomstore"
Jan-13 02:28:06.453 [Store] info: Created table schema
Jan-13 02:28:06.471 [Store] info: Created table user_store
Jan-13 02:28:06.481 [Store] info: Created table chan_store
Jan-13 02:28:06.492 [Store] info: Created table puppet_store
Jan-13 02:28:06.504 [Store] info: Created table chan_op
Jan-13 02:28:06.504 [Store] info: Updated database to version  1
Jan-13 02:28:06.516 [Store] info: Updating database to v2, "puppetmxidstore"
Jan-13 02:28:06.569 [Store] info: Created table puppet_mxid_store
Jan-13 02:28:06.570 [Store] info: Updated database to version  2
Jan-13 02:28:06.646 [Store] info: Updating database to v3, "add puppet_id to user_store"
Jan-13 02:28:06.729 [Store] info: Created table user_store_tmp
Jan-13 02:28:06.802 [Store] info: Updated database to version  3
Jan-13 02:28:06.833 [Store] info: Updating database to v4, "ghosts_joined_chans"
Jan-13 02:28:06.861 [Store] info: Created table ghosts_joined_chans
Jan-13 02:28:06.861 [Store] info: Updated database to version  4
Jan-13 02:28:06.886 [Store] info: Updating database to v5, "create event_store"
Jan-13 02:28:06.911 [Store] info: Created table event_store
Jan-13 02:28:06.911 [Store] info: Updated database to version  5
Jan-13 02:28:06.936 [Store] info: Updating database to v6, "Add status room"
Jan-13 02:28:06.961 [Store] info: Updated database to version  6
(node:6) UnhandledPromiseRejectionWarning: Error: Forbidden.
    at Request._callback (/opt/mx-puppet-twitter/node_modules/twitter-webhooks/lib/helpers.js:27:33)
    at Request.self.callback (/opt/mx-puppet-twitter/node_modules/request/request.js:185:22)
    at Request.emit (events.js:209:13)
    at Request.<anonymous> (/opt/mx-puppet-twitter/node_modules/request/request.js:1161:10)
    at Request.emit (events.js:209:13)
    at IncomingMessage.<anonymous> (/opt/mx-puppet-twitter/node_modules/request/request.js:1083:12)
    at Object.onceWrapper (events.js:298:28)
    at IncomingMessage.emit (events.js:214:15)
    at endReadableNT (_stream_readable.js:1178:12)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)
(node:6) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:6) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

from mx-puppet-twitter.

cvincent avatar cvincent commented on July 19, 2024

Oh, I think I see what you mean. I've configured server.url to point to Synapse. Instead you're saying this should be a publicly accessible URL for Twitter webhooks? I'll give that a shot.

from mx-puppet-twitter.

cvincent avatar cvincent commented on July 19, 2024

Okay, looks like I need to apply for a new developer account, as I was using an old API app which didn't include "environments". Chances are that's the whole issue here. I'll report back!

from mx-puppet-twitter.

cvincent avatar cvincent commented on July 19, 2024

Yep, that was it. Unfortunately, Twitter webhooks only allow port 443, which I won't be able to get set up for tonight. I'll close this ticket, thanks for the help!

from mx-puppet-twitter.

cvincent avatar cvincent commented on July 19, 2024

Okay, I'm very close! I got a cheap VPS to reverse proxy ports back to my homeserver to get around my ISP blocking port 443 (among others). Been meaning to do this for a long time as it is.

I was still having a hell of a time getting it to receive the webhook. Finally I figured out that setting the twitter.server.host in the config to localhost doesn't work; it needed set to 0.0.0.0. And with that, starting the Docker container now shows that it's setting up the webhook correctly.

Now the problem is starting the application service. Here's the top of the stack trace in the log:

Jan-17 05:39:40.973 [PuppetBridge] info: Starting application service....
(node:6) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'endsWith' of undefined
    at new MatrixClient (/opt/mx-puppet-twitter/node_modules/matrix-bot-sdk/lib/MatrixClient.js:70:32)
    at new Intent (/opt/mx-puppet-twitter/node_modules/matrix-bot-sdk/lib/appservice/Intent.js:30:23)
    at Appservice.getIntentForUserId (/opt/mx-puppet-twitter/node_modules/matrix-bot-sdk/lib/appservice/Appservice.js:179:22)
    at Appservice.get botIntent [as botIntent] (/opt/mx-puppet-twitter/node_modules/matrix-bot-sdk/lib/appservice/Appservice.js:107:21)
    at /opt/mx-puppet-twitter/node_modules/matrix-bot-sdk/lib/appservice/Appservice.js:125:28

Looking through the source code, my best guess is my configuration is missing the homeserver URL. I tried adding this to the config.yaml, taking my best guess from another puppet I've set up:

homeserver:
    address: http://192.168.1.114:8008
    domain: [redacted]

But I end up getting the same error. Any other hints?

from mx-puppet-twitter.

cvincent avatar cvincent commented on July 19, 2024

Nevermind, figured out the configuration issue after seeing the bridge section of this file:
https://github.com/matrix-discord/mx-puppet-discord/blob/master/sample.config.yaml

The bridge now sets up without any errors. Now I just need to know how to use it! I've successfully joined a room with the Twitter bot. Not sure how to link my account, it says I don't have permission, but I'm gonna muddle through the Discord puppet readme and see if I can figure it out.

from mx-puppet-twitter.

cvincent avatar cvincent commented on July 19, 2024

Once more, the answer to my problem was in the Discord puppet config, under the provisioning section. I've now got my account linked.

Would you accept a PR updating the README and adding a sample.config.yaml to assist others with setup? This has been a learning experience!

from mx-puppet-twitter.

Sorunome avatar Sorunome commented on July 19, 2024

Glad you figured it all out! Yeah, it would be great if you could PR those things!

from mx-puppet-twitter.

cvincent avatar cvincent commented on July 19, 2024

Ok I'll probably get something up this evening. In the meantime, while I have the puppet apparently running happily and I've linked my account, I'm not sure how to use it from there. I assume I want to create rooms with certain name formats for DMs (what I'm mainly interested in) and timelines and such?

from mx-puppet-twitter.

cvincent avatar cvincent commented on July 19, 2024

@Sorunome had a few quick questions, wasn't sure the right place to ask. My bridge appears to mostly work, as when I have a one-to-one DM conversation on Twitter, the bridge bot invites me to a room in Riot for that conversation, and then I can continue the conversation in Riot. Very cool! Here are my questions:

  • Is it possible to initiate new DM conversations via the bridge?
  • Does the bridge work at all for group DMs? If not, is this a limitation of the Twitter API, or something that can be added? Most of my Twitter chatting is in group DMs, so I'd like to help here if possible.
  • Does the bridge allow following Twitter searches, hashtags, or accounts? If so, how would I do that?

from mx-puppet-twitter.

Sorunome avatar Sorunome commented on July 19, 2024

wasn't sure the right place to ask

You could always ask in the support channel! #mx-puppet-bridge:sorunome.de

Is it possible to initiate new DM conversations via the bridge?

For the twitter bridge soru believes she didn't find a way to find out with whom all you can potentially start a DM convo, so no

Does the bridge work at all for group DMs? If not, is this a limitation of the Twitter API, or something that can be added? Most of my Twitter chatting is in group DMs, so I'd like to help here if possible.

Been some time, literally don't remember ^^"

Does the bridge allow following Twitter searches, hashtags, or accounts? If so, how would I do that?

No, it does not. It makes more sense to use a normal bot for such things than a puppeting bridge....puppeting bridges are kinda for chats

from mx-puppet-twitter.

cvincent avatar cvincent commented on July 19, 2024

You could always ask in the support channel! #mx-puppet-bridge:sorunome.de

I still need to set up my homeserver for federation, and then I will get on!

For the twitter bridge soru believes she didn't find a way to find out with whom all you can potentially start a DM convo, so no

I think this is accurate. I went through the Twitter API docs and it seems to me that the whole thing is really set up for marketing and customer service automation, not really to be able to develop alternative chat clients. This would explain why the API doesn't allow initiating new conversations, and why it only supports one-to-one DMs (which I've all but confirmed in my API research).

It seems like to build a fully-featured puppet which allows initiating conversations and supports group conversations, we would need to go beyond what's available through the API. This could mean screen scraping and reverse engineering the HTTP APIs used by Twitter's own web app. I'm personally so infuriated by the fragmentation of messaging platforms that I might be willing to pursue this. Would these be welcome additions to this repo, or do you think it would be better to pursue as its own project?

No, it does not. It makes more sense to use a normal bot for such things than a puppeting bridge....puppeting bridges are kinda for chats

Good point!

from mx-puppet-twitter.

surakin avatar surakin commented on July 19, 2024

The puppet is running on the same box as Synapse as well as another puppet. The port is exposed and Synapse should be able to access it.

Here's the log output for the Docker container:

Jan-13 02:28:06.259 [Store] info: Starting DB Init
Jan-13 02:28:06.262 [Store] info: Filename present in config, using sqlite
Jan-13 02:28:06.262 [SQLite3] info: Opening database.db
Jan-13 02:28:06.266 [Store] warn: Couldn't fetch schema version, defaulting to 0
Jan-13 02:28:06.266 [Store] info: Database schema version is 0, latest version is 6
Jan-13 02:28:06.266 [Store] info: Updating database to v1, "Schema, Userstore, Roomstore"
Jan-13 02:28:06.453 [Store] info: Created table schema
Jan-13 02:28:06.471 [Store] info: Created table user_store
Jan-13 02:28:06.481 [Store] info: Created table chan_store
Jan-13 02:28:06.492 [Store] info: Created table puppet_store
Jan-13 02:28:06.504 [Store] info: Created table chan_op
Jan-13 02:28:06.504 [Store] info: Updated database to version  1
Jan-13 02:28:06.516 [Store] info: Updating database to v2, "puppetmxidstore"
Jan-13 02:28:06.569 [Store] info: Created table puppet_mxid_store
Jan-13 02:28:06.570 [Store] info: Updated database to version  2
Jan-13 02:28:06.646 [Store] info: Updating database to v3, "add puppet_id to user_store"
Jan-13 02:28:06.729 [Store] info: Created table user_store_tmp
Jan-13 02:28:06.802 [Store] info: Updated database to version  3
Jan-13 02:28:06.833 [Store] info: Updating database to v4, "ghosts_joined_chans"
Jan-13 02:28:06.861 [Store] info: Created table ghosts_joined_chans
Jan-13 02:28:06.861 [Store] info: Updated database to version  4
Jan-13 02:28:06.886 [Store] info: Updating database to v5, "create event_store"
Jan-13 02:28:06.911 [Store] info: Created table event_store
Jan-13 02:28:06.911 [Store] info: Updated database to version  5
Jan-13 02:28:06.936 [Store] info: Updating database to v6, "Add status room"
Jan-13 02:28:06.961 [Store] info: Updated database to version  6
(node:6) UnhandledPromiseRejectionWarning: Error: Forbidden.
    at Request._callback (/opt/mx-puppet-twitter/node_modules/twitter-webhooks/lib/helpers.js:27:33)
    at Request.self.callback (/opt/mx-puppet-twitter/node_modules/request/request.js:185:22)
    at Request.emit (events.js:209:13)
    at Request.<anonymous> (/opt/mx-puppet-twitter/node_modules/request/request.js:1161:10)
    at Request.emit (events.js:209:13)
    at IncomingMessage.<anonymous> (/opt/mx-puppet-twitter/node_modules/request/request.js:1083:12)
    at Object.onceWrapper (events.js:298:28)
    at IncomingMessage.emit (events.js:214:15)
    at endReadableNT (_stream_readable.js:1178:12)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)
(node:6) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:6) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Hi! I'm having this exact same problemand I can't figure out what's wrong. I have set up the reverse proxy but it still fails. Did I miss something?

from mx-puppet-twitter.

Sorunome avatar Sorunome commented on July 19, 2024

Maybe you should make a new issue so that not everything gets dumped into a closed/old issue?

from mx-puppet-twitter.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.