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

Will be the plugin able to handle workplace chat ? #371

Open
cicciofuser opened this Issue Sep 22, 2017 · 44 comments

Comments

Projects
None yet
7 participants
@cicciofuser

cicciofuser commented Sep 22, 2017

Hi,
I'm using this plugin and I would like to know if handling the workplace chat is into the roadmap ?

Thanks a lot

@marsjaninzmarsa

This comment has been minimized.

marsjaninzmarsa commented Sep 22, 2017

How such chats are handled by Facebook Messenger for Android?

@jaymzh

This comment has been minimized.

jaymzh commented Nov 14, 2017

There's a separate app. It logs in through .facebook.com. I believe bitlbee just got support for it, so hopefully it can make its way here in short order.

@jaymzh

This comment has been minimized.

jaymzh commented Nov 14, 2017

bitlbee/bitlbee-facebook@24db488 adds support.

@dequis - any chance of getting this pulled in ? In the meantime, would that patch apply to purple-facebook's codebase?

@jaymzh

This comment has been minimized.

jaymzh commented Dec 14, 2017

I'm happy to donate moneys for this, btw

@jaymzh

This comment has been minimized.

jaymzh commented Jan 2, 2018

Happy New Year @dequis !

Just wanted to loop back around to this... any thoughts?

@dequis

This comment has been minimized.

Owner

dequis commented Jan 3, 2018

Hm. Poke me in two weeks.

@jaymzh

This comment has been minimized.

jaymzh commented Jan 3, 2018

Will do. Thanks!

@jaymzh

This comment has been minimized.

jaymzh commented Jan 14, 2018

Roughly two-week ping, as requested. :)

@jaymzh

This comment has been minimized.

jaymzh commented Jan 18, 2018

Any guesses here on ETA?

@dequis

This comment has been minimized.

Owner

dequis commented Jan 19, 2018

This weekend, hopefully!

@dequis

This comment has been minimized.

Owner

dequis commented Jan 23, 2018

So, since this issue exists due to the divergence between both projects and the hassle that is updating stuff in this one, I'm going to try to do this The Right Way™ for once.

And this is going to take some yak shaving:

  1. Split the actual code of this plugin from the pidgin hg repo to a standalone git repo
  2. Change the build system of this thing to use a git submodule
  3. Pick one indentation style, either the one in this plugin or the one in the other plugin.
  4. Diff stuff and unify changes
  5. Get bitlbee-facebook to use that submodule too. This means adapting the http code
  6. Do something about the fact that there's a second build of purple-facebook to fix hangs after login because fixing someone's hang after login broke it for other random set of people (issue 366)
  7. Make releases for both plugins, probably naming them 2.0 to sync version numbers.

I'll probably have a branch up with this feature by step 4.

Right now I'm at the first step - git subtree is nice and easier to use than i expected, but uhm, at some point in the last year my pidgin hggit repo suffered from some data corruption in a packfile which results in i/o errors and crashing git. I'll have to report that to git at some point. At least now i'm fairly sure that the corruption isn't a big deal, and made backups.

@jaymzh

This comment has been minimized.

jaymzh commented Jan 23, 2018

Oh that would be awesome @dequis - you not having to do back/forward ports all the time would just generally make everyone happier I think. :) Thanks! Happy to help with testing things along the way.

@jaymzh

This comment has been minimized.

jaymzh commented Jan 30, 2018

Hey @dequis - I figured I'd check in on how it's going. Also if you want any help with the git stuff, it's been a while but I've had to jam git subtree, and hggit together before, so if you run into weird things I can probably help.

@jaymzh

This comment has been minimized.

jaymzh commented Feb 6, 2018

2 week check-in - how's this going?

@dequis

This comment has been minimized.

Owner

dequis commented Feb 7, 2018

Hi! Couldn't allocate much time to this lately, but it's definitely in my mind.

@dequis

This comment has been minimized.

Owner

dequis commented Feb 14, 2018

Here's a thing! https://github.com/dequis/purple-facebook/tree/wip-work-chat

Didn't test much and the sso auth looks very ugly (you don't need that part anyway)

This sort-of covers up to step 4 of the plan above. There's more to unify but... some other day.

At least now I have two trees with equivalent indentation style and as a side effect of this i managed to spot what went wrong with the "hang after login" bug, so, yay.

@jaymzh

This comment has been minimized.

jaymzh commented Feb 14, 2018

yay!!

OK so I checked out that branch, ran ./autogen.sh;./configure;make;sudo make install and restarted pidgin, but I don't see how to sign into a workplace account. I don't have a new type of account, or any options under the Facebook type. Did I miss something?

@dequis

This comment has been minimized.

Owner

dequis commented Feb 14, 2018

Modify account -> advanced tab -> login as a workplace account

@jaymzh

This comment has been minimized.

jaymzh commented Feb 14, 2018

Ah, I see that. But I can't add another account with the same username... does that mean I can't login to both my personal and work account at the same time? Or does that checkbox log into both?

@jaymzh

This comment has been minimized.

jaymzh commented Feb 14, 2018

OK so I took my current account and checked the box and signed out/in - but I'm still connected to my personal account... I can message people on my personal account, but not my work account and work messages don't show up on it.

@dequis

This comment has been minimized.

Owner

dequis commented Feb 14, 2018

Oh. That's awkward. Maybe I'll do another account type then.

Changing that checkbox in your personal account won't do anything because it's logging in with the cached access token of the personal account.

You could take advantage of that to change the username of your personal account to something else, which will be ignored until the next actual login. Or use an alternative way to represent the username, like phone number or facebook username (as in facebook.com/thisusername without the facebook.com/)

But yeah, you need to add a new account for it to try to login with this method.

@jaymzh

This comment has been minimized.

jaymzh commented Feb 14, 2018

I can do that temporarily just to test, but it'll break when that token expires, as you implied... so yeah I think we'll need a new accountype.

Also, it's worth noting you can be a member of more than one Workplace. It's not common... but you could for example be part of a non-profit and a group that both use Workplace.... I'm not sure how this effects things.

@jaymzh

This comment has been minimized.

jaymzh commented Feb 14, 2018

Oh I take that back. I can use my work email as the login.

@jaymzh

This comment has been minimized.

jaymzh commented Feb 14, 2018

IT WORKS!!!!! <3 <3 <3 <3 <3 <3 <3 <3 <3

@dequis

This comment has been minimized.

Owner

dequis commented Feb 15, 2018

Yay.

Also, it's worth noting you can be a member of more than one Workplace. It's not common... but you could for example be part of a non-profit and a group that both use Workplace.... I'm not sure how this effects things.

So the thing is that certain companies which were early adopters of workplace (have a guess) rely on the now-deprecated login method personal_account_password_with_work_username (this is discoverable by poking emails into prelogin)

As far as I know, this is the only method that allows having multiple work "communities" at the same time, and newly created orgs don't have that, and just use the more-common method work_account_password which is a plain work email - work password association, with different usernames for each company.

I mentioned this here bitlbee/bitlbee-facebook@24db488

  1. Linked personal account

This is deprecated but still needed in some companies. Looks just
like password auth to users. In rare cases there may be more than
one work account linked to a personal account, in which case this
will only use the first one. Usually they can be de-linked by
assigning a password (see the official docs)

I think it's rare enough that it's safe to wait for someone to complain, if they actually need it and de-linking doesn't work.

The commit also says

In all cases, the username is the work account email

I totally forgot about this, the whole personal account linking mess confused me. Sooo yeah, the username conflict is not that big of a deal, I guess!

@jaymzh

This comment has been minimized.

jaymzh commented Feb 15, 2018

Yup. Makes sense. This is working really well for me for the last hour or so. I'll install it on other machines tonight and let you know if I hit any problems. Let me know if there's anything else I can provide or test.

Thank you so much!

@jaymzh

This comment has been minimized.

jaymzh commented Feb 15, 2018

This morning my workplace account is disconnecting with Invalid API key (101)

@dequis

This comment has been minimized.

Owner

dequis commented Feb 15, 2018

Heh it's bitlbee/bitlbee-facebook@553593d again. I knew I had applied some of it because it's in api.c, but I didn't notice there was another file.

Pushed fix to the same branch as 68ca266

@jaymzh

This comment has been minimized.

jaymzh commented Feb 15, 2018

Sweet, thanks!

@jaymzh

This comment has been minimized.

jaymzh commented Feb 25, 2018

So far so good... but I have found one bug. If someone sends a message that has a link it in, the message does not come through at all. This seems to be specific to the work account.

@dequis

This comment has been minimized.

Owner

dequis commented Feb 25, 2018

Can't reproduce, sooo, you're on your own! I'm not going to ask for debug logs for this one. Maybe try to convince the gatekeepers to have it apply to everyone first.

If you want to have a look at it yourself, a normal incoming message with a URL and no attached preview (or, in this case, explicitly removed by clicking the X in the preview before sending) looks like this:

(23:19:02) facebook: Parsing JSON: {"deltas":[{"deltaNewMessage":{"messageMetadata":{"threadK
ey":{"otherUserFbId":100015634145083},"messageId":"mid.$cAAAAACblQZRn_AboIFhysGffiVYN","offli
neThreadingId":6373350382861112845,"actorFbId":100015070322351,"timestamp":1519525142560,"sho
uldBuzzDevice":1,"tags":["source:chat:web"],"skipSnippetUpdate":0},"body":"https://www.youtub
e.com/watch?v=SBjQ9tuuTJQ","attachments":[]}}],"firstDeltaSeqId":180,"lastIssuedSeqId":180}

And one with attached preview looks like this:

(23:19:12) facebook: Parsing JSON: {"deltas":[{"deltaNewMessage":{"messageMetadata":{"threadK
ey":{"otherUserFbId":100015634145083},"messageId":"mid.$cAAAAACblQZRn_Ab3d1hysGtSjnAT","offli
neThreadingId":6373350397675728915,"actorFbId":100015070322351,"timestamp":1519525146487,"sho
uldBuzzDevice":1,"tags":["source:chat:web"],"skipSnippetUpdate":0},"body":"https://www.youtub
e.com/watch?v=SBjQ9tuuTJQ","attachments":[{"id":"338706133308395","fbid":338706133308395,"xma
GraphQL":"{\"ZXh0ZW5zaWJsZV9tZXNzYWdlX2F0dGFjaG1lbnQ6MzM4NzA2MTMzMzA4Mzk1\":{\"__type__\":{\"
name\":\"ExtensibleMessageAttachment\"},\"id\":\"ZXh0ZW5zaWJsZV9tZXNzYWdlX2F0dGFjaG1lbnQ6MzM4
NzA2MTMzMzA4Mzk1\",\"is_forwardable\":true,\"story_attachment\":{\"deduplication_key\":\"f222
7d9244cdaceefacad8d8486a7b9b\",\"description\":{\"text\":\"Foo Fighters' official music video
 for 'The Pretender'. Click to listen to Foo Fighters on Spotify: http:\\/\\/smarturl.it\\/Fo
oFSpotify?IQid=FooFTP As featured on...\"},\"media\":{\"__type__\":{\"name\":\"GenericAttachm
entMedia\"},\"image\":{\"uri\":\"https:\\/\\/external.faep4-1.fna.fbcdn.net\\/safe_image.php?
d=AQC3yyAZufZKdHyP&w=960&h=960&url=https\\u00253A\\u00252F\\u00252Fi.ytimg.com\\u00252Fvi\\u0
0252FSBjQ9tuuTJQ\\u00252Fmaxresdefault.jpg&cfs=1&_nc_hash=AQB6cihzAtJolOgq\"},\"playable_url\
":\"https:\\/\\/www.youtube.com\\/embed\\/SBjQ9tuuTJQ?autoplay=1\"},\"properties\":[{\"attach
ment_property_type\":\"double\",\"key\":\"width\",\"value\":{\"text\":\"1536\"}},{\"attachmen
t_property_type\":\"double\",\"key\":\"height\",\"value\":{\"text\":\"864\"}}],\"source\":{\"
text\":\"youtube.com\"},\"style_list\":[\"share\",\"fallback\"],\"target\":{\"__type__\":{\"n
ame\":\"ExternalUrl\"}},\"title\":\"Foo Fighters - The Pretender\",\"tracking\":\"{}\",\"url\
":\"fbrpc:\\/\\/facebook\\/nativethirdparty?app_id=87741124305&tap_behavior=app_fallback_web&
target_url=https\\u00253A\\u00252F\\u00252Fwww.youtube.com\\u00252Fwatch\\u00253Fv\\u00253DSB
jQ9tuuTJQ&extra_applink_key=al_applink_data&referer_data_key=extras&al_applink_data=\\u00257B
\\u002522target_url\\u002522\\u00253A\\u002522https\\u00253A\\u00255C\\u00252F\\u00255C\\u002
52Fwww.youtube.com\\u00255C\\u00252Fwatch\\u00253Fv\\u00253DSBjQ9tuuTJQ\\u002522\\u00252C\\u0
02522extras\\u002522\\u00253A\\u00257B\\u002522fb_app_id\\u002522\\u00253A87741124305\\u00257
D\\u00252C\\u002522referer_app_link\\u002522\\u00253A\\u00257B\\u002522url\\u002522\\u00253A\
\u002522fb-messenger\\u00253A\\u00255C\\u00252F\\u00255C\\u00252F\\u00255C\\u00252F\\u002522\
\u00252C\\u002522app_name\\u002522\\u00253A\\u002522Messenger\\u002522\\u00252C\\u002522packa
ge\\u002522\\u00253A\\u002522com.facebook.orca\\u002522\\u00257D\\u00257D&appsite_data=\\u002
57B\\u002522android\\u002522\\u00253A\\u00255B\\u00257B\\u002522is_app_link\\u002522\\u00253A
true\\u00252C\\u002522app_name\\u002522\\u00253A\\u002522YouTube\\u002522\\u00252C\\u002522ap
psite_url\\u002522\\u00253A\\u002522vnd.youtube\\u00253A\\u00255C\\u00252F\\u00255C\\u00252Fw
ww.youtube.com\\u00255C\\u00252Fwatch\\u00253Fv\\u00253DSBjQ9tuuTJQ\\u002526feature\\u00253Da
pplinks\\u002522\\u00252C\\u002522fallback_url\\u002522\\u00253A\\u002522https\\u00253A\\u002
55C\\u00252F\\u00255C\\u00252Fwww.youtube.com\\u00255C\\u00252Fwatch\\u00253Fv\\u00253DSBjQ9t
uuTJQ\\u002522\\u00252C\\u002522market_uri\\u002522\\u00253A\\u002522market\\u00253A\\u00255C
\\u00252F\\u00255C\\u00252Fdetails\\u00253Fid\\u00253Dcom.google.android.youtube\\u002526refe
rrer\\u00253Dutm_source\\u00255Cu00253Dapps.facebook.com\\u00255Cu002526utm_campaign\\u00255C
u00253Dfb4a\\u00255Cu002526utm_content\\u00255Cu00253D\\u00255Cu0025257B\\u00255Cu00252522app
\\u00255Cu00252522\\u00255Cu0025253A87741124305\\u00255Cu0025252C\\u00255Cu00252522t\\u00255C
u00252522\\u00255Cu0025253A1519525146\\u00255Cu0025257D\\u002522\\u00252C\\u002522package\\u0
02522\\u00253A\\u002522com.google.android.youtube\\u002522\\u00257D\\u00255D\\u00257D&has_app
_link=1&accessToken=https\\u00253A\\u00252F\\u00252Fwww.youtube.com\\u00252Fwatch\\u00253Fv\\
u00253DSBjQ9tuuTJQ\"}}}"}]}}],"firstDeltaSeqId":181,"lastIssuedSeqId":181}

The xmaGraphQL looks super hairy but that's mostly because it's json inside a string, and then even more serialization inside the fbrpc:// url (which i believe only happens when it knows a native app that could load it, in this case youtube)

In this case both have a "body" with text (fourth line in the paste above), that ensures there's a text representation of it.

Otherwise we have to dig into the fbrpc:// url. That can happen if you paste the url in the web client, let the preview generate, then remove the url from the body of the message. Or with some kinds of "share" features. The code that digs into that url is bitlbee/bitlbee-facebook@3e8dd70 - this sounds like the weakest part of the whole thing, but I haven't seen it fail yet.

There's also code that omits showing the second url if it's the same as the one in the body, but I don't expect that will break it.

Anyway that's pretty much all I know. Open a debug window, receive a link and go nuts.

@manuelnaranjo

This comment has been minimized.

manuelnaranjo commented Mar 7, 2018

Great work! I can connect to my workplace account with it, even behind SSO! I will try to make a build of this for Adium, any idea when this will be merged back into the main plugin?

@jaymzh

This comment has been minimized.

jaymzh commented Mar 23, 2018

@dequis - can we merge this to master? I merged the recent TLS stuff onto the wip branch, but it'd be nice to just be able to build with all the latest stuff.

@jschwartzenberg

This comment has been minimized.

jschwartzenberg commented Jun 15, 2018

I just merged this to master (in my own fork) and did a build. I can log in without problems, but then it's not really obvious how I could start a chat with someone.
Maybe some UI is still needed to search for colleagues to chat with? I guess it could be done similarly to how the SIPE plug-in does it.

@jaymzh

This comment has been minimized.

jaymzh commented Oct 8, 2018

@dequis - workplace + 2fac seems to not be working for me wiht the same flow...
login -> modify acct to add 2fac code -> click save, it claims Invalid username or password again.

@dequis

This comment has been minimized.

Owner

dequis commented Oct 9, 2018

@jaymzh fun. Honestly the thing of using the password field for 2fa auth codes always seemed like a hack that worked magically because the server is generous. Was your auth flow work_account_password or personal_account_password_with_work_username?

@dequis

This comment has been minimized.

Owner

dequis commented Oct 9, 2018

Oh also a general update: been kinda neglecting this plugin for a while due to work stuff combined with burnout and all. Just returned from a three week vacation and i'm starting a new job next month, so i'll deal with whatever needs to be done in this plugin in the next couple of weeks.

@jaymzh

This comment has been minimized.

jaymzh commented Oct 9, 2018

personal_account_password_with_work_username. Our workplace doesn't have separate passwords. :/

@jaymzh

This comment has been minimized.

jaymzh commented Nov 1, 2018

Hey @dequis - any information I can provide? Logs?

@jaymzh

This comment has been minimized.

jaymzh commented Nov 5, 2018

@dequis - can/will donate money to you or your favorite charity :)

@Let-Vogel

This comment has been minimized.

Let-Vogel commented Nov 9, 2018

Any news about this? Using facebook workplace through browser is making me want to shoot my head off

@jaymzh

This comment has been minimized.

jaymzh commented Nov 10, 2018

So I found a workaround:

  • Login with <workemail> / <fb password>
  • pidgin will tell you to wait for the sms code
  • go to facebook.com in a browser, and click the notification that your account is being accessed, verify it, click "yes this was me" and then BE SURE to choose "save browser"
  • then put the SMS code into pidgin

that works for me now.

@jaymzh

This comment has been minimized.

jaymzh commented Nov 12, 2018

Hmm, I can't consistently make this work on workplace, sometimes it does, sometimes it doesn't. :/

@jaymzh

This comment has been minimized.

jaymzh commented Nov 19, 2018

@dequis - Gentle ping?

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