Other subscriptions sending DM

directmessages
account-activity

#1

Hello.
I managed to get the account-activity-dashboard working and I’ve been using it to create a sort of chatbot that “serves” multiple accounts.

Say I have 2 accounts subscribed to my app, a regular account and the app owner, I can get every direct message they receive just fine but when I answer it, only the app owner sends the direct message back, regards of which account actually received the direct message.

The direct_messages/events/new doesn’t say anything about setting the “sender” the same way we set the “recipient”. I’ve been using the auth from the auth.js in the “helper” folder so I’m not sure if it’s a oath issue or if I’m trying to do something that just isn’t possible. The custom profile doc isn’t very clear on what it can or can’t do but it doesn’t seem like it does what I need it to. My biggest fear is having to create a new app for every user+chatbot I need.

Any help?


#2

This is an auth issue. You need to post the DMs using the access token and secret for the sending user. The auth.js file is only for the application owner. You’ll need to use the access tokens returned when the user subscription is created when the other user signs in. I don’t remember if there’s specific code to handle and store this in the sample that we provided (the user information is just stored in the session, rather than persisted to a data store) so you may have to implement that additional step yourself.

Note that, per the README, you should really look at enhancing various aspects of the sample code before using it in a production scenario.


#3

Thanks, that’s exactly what I wanted to know.

Note that, per the README 1, you should really look at enhancing various aspects of the sample code before using it in a production scenario.

Yeah, I know. Right now I’m only working on a prototype so It’s all very simple.