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

FromRocketChatMessage data object outdated #76

Open
zugao opened this issue Jul 16, 2020 · 2 comments
Open

FromRocketChatMessage data object outdated #76

zugao opened this issue Jul 16, 2020 · 2 comments

Comments

@zugao
Copy link

zugao commented Jul 16, 2020

In the logs there's always this warn:
2020-04-15 09:50:22,181 [qtp1667043665-64] WARN s.g.r.s.r.RocketChatMessageRoute - Invalid JSON in request body: Expected a boolean but was BEGIN_OBJECT at line 1 column 44 path $.bot

After checking the code I noticed that the class FromRocketChatMessage is outdated in regards to the message received from newest version of RocketChat, "bot" field is not a boolean anymore. Can we expect an update? Or any review from your part in case I open a PullRequest?

@gustavkarlsson
Copy link
Owner

I'm not actively maintaining this anymore. I'll happily take a look at a PR, if you provide the appropriate tests (some screenshots would be cool too). But keep in mind that changing the data type of a property might break older clients.

@dscheffer
Copy link

dscheffer commented Mar 3, 2021

In case anybody is wondering what is going on with this error:

I imagine it is because rocket.chat used to send whether a message is from a bot or not via a simple boolean flag. But now apparently rocket.chat sends some sort of user token when a message is from a bot instead of a flag. On the other hand, when a message is not from a bot, rocket.chat sends a flag like it used to. This is in my opinion horrible, horrible API design because the data type of the "bot" flag changes all the time.

This issue is by the way the exact same issue as #74. Apparently, the rocketchat-jira-trigger sends a 404 error when the provided json does not conform to the expected structure.

I have found a workaround for this. In the outgoing webhook configuration of your rocket.chat server activate the script and paste the following in there:

class Script {

  prepare_outgoing_request({ request }) {
    if (request.data.bot !== undefined && request.data.bot !== false) {
      var botRequest = Object.assign({}, request);
      botRequest.data.bot = true;
      return botRequest;
    }
    return request;
  }

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants