qnabot-on-aws icon indicating copy to clipboard operation
qnabot-on-aws copied to clipboard

Twitter DM bot (?)

Open matthewberryman opened this issue 6 years ago • 3 comments

Short of AWS supporting Twitter DM APIs (now in beta, https://developer.twitter.com/en/docs/direct-messages/beta-features ) directly, perhaps support for Twitter DMs could be added to this project? I have done some work on that https://github.com/MSFREACH/msf-reach-chatbot/commit/b0d950f6a6d76ed970b9ec928797986be36f20de albeit using serverless rather than CloudFormation directly. Note this code isn't tested yet (so consider it beta) as I'm waiting on beta access to be approved for one of the Twitter accounts I run, however it's based on some code that does work.

matthewberryman avatar Dec 01 '17 09:12 matthewberryman

Ok the code in https://github.com/MSFREACH/msf-reach-chatbot is working—I have my AWS AI QNA bot talking on Twitter as well as Facebook now. The code there is still a bit rough and there are a few things I'd like to tidy up and work on, in terms of the interactions between the FB part & core code, as well as https://github.com/MSFREACH/msf-reach-chatbot/issues/10 . Perhaps since the rest of the QNA code is in nodejs I should rewrite in nodejs, and AFAIK we've not had that warmup issue with our separate Twitter DM bot code (@talltom ?). I started with Python as there was already an example I drew on for that bit of code for exposing a Lex bot on Twitter DM.

matthewberryman avatar Dec 07 '17 07:12 matthewberryman

If i understand your code correctly, you are creating an api in front of lex to serve Twitter? I have seen this before and i think it is very cleaver. This could be done by making a "twitter-lex-proxy" resource in the api, perhaps under the client resource

JohnCalhoun avatar Dec 09 '17 15:12 JohnCalhoun

@JohnCalhoun yes, that's correct. I have now ported the code to JavaScript in https://github.com/MSFREACH/msf-reach-chatbot/tree/twitter-webhook-js and it all seems to work bar the rate limit issue (something we would need Twitter to whitelist our account for). I would still need to bring the API, currently deployed separately using serverless, into the main API, under a twitter-lex-proxy resource as you suggest.

matthewberryman avatar Dec 10 '17 05:12 matthewberryman