Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for slack Events api #66

Closed
wants to merge 10 commits into from
2 changes: 1 addition & 1 deletion lib/BridgedRoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ BridgedRoom.prototype.lookupAndSetUserInfo = function() {
json: true,
});
}).then((response) => {
if (!response.user && response.user.profile) return Promise.resolve();
if (!response.user && response.user.profile) return;

if (!this._slack_bot_id !== response.user.profile.bot_id) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error came from here, because response his:

{ ok: false,
  error: 'missing_scope',
  needed: 'users:read',
  provided: 'identify,bot,channels:history,groups:history,team:read,files:write:user' }

I added "users:read" in oauth permission, and "user_change" in events, but now when I add the link, I got the message "Row is now pending-name" but the room does not show up in rooms list and link is not working.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you providing both the bot & user tokens? --slack_bot_token xoxb-xxxxxxxxxx-xxxxxxxxxxxxxxxxxxxx --slack_user_token xoxp-xxxxxxxx-xxxxxxxxx-xxxxxxxx-xxxxxxxx

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and did you have the files:write:user permission. I don't think you would need this, but it would help me debug if I knew how your's was set

this._slack_bot_id = response.user.profile.bot_id;
Expand Down
7 changes: 5 additions & 2 deletions lib/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -422,8 +422,11 @@ Main.prototype.onMatrixEvent = function(ev) {
// A membership event about myself
var membership = ev.content.membership;
if (membership === "invite") {
// Automatically accept all invitations
this.getBotIntent().join(ev.room_id);
// Automatically accept all invitations, but wait 30 seconds before doing it.
// this was throwing an error when the bot was invited to a room by a user on
// a different homeserver ({"errcode":"M_FORBIDDEN","error":"You are not invited to this room."})
Promise.delay(30 * 1000).then(() => this.getBotIntent().join(ev.room_id));

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty line.

And this feels like a bug in Synapse :s. I wonder if it can be reproduced with a normal client or if it is related to the appservice API.

}

endTimer({outcome: "success"});
Expand Down