Open ChristianRiesen opened 3 years ago
Hi!
I started reading the code and I will need more time to dig into it, but I can already tell you: this looks awesome! Thanks a lot for your interest in this project!
Working in johansatge/workflowy-php
sounds good to me, so feel free to open a PR.
I could also invite you as a contributor in the repo if you want to keep on maintaining it later. As you probably noticed I didn't have much time myself to do so in the few last years 😅
Thanks again for your work!
Life keeps us busy I completely understand. I only picked this up because I wanted to use WorkFlowy within my personal API project to add items automatically to a todo or a shopping list. I found your library through some post on the official workflowy support page and after it did what I wanted and I found it kludgy to do what I wanted, I started altering it and pulling on threads.. well then this thing on my branch happened over time :)
The major thing is that it requires PHP 7.4 now. And then next is the whole interaction is different. All the hard work is done inside the client class, and most other classes are just value objects more or less.
So I'll finish up the changes to export and see that I can at least make sure that php cs fixer is happy and maybe dial back phpstan to a level that is acceptable as well. Once that is done I'll make a MR. Maybe add a test or two.
@johansatge made the PR #14 for your approval.
I always feel like an archaeologist doing this... seems like half the things I google fall into the category of "someone else also once needed that but no longer does"...
You two still alive? Is this repo something that would have to start again with changes to WF or maybe not?
Hope you're doing well 3 years later. :)
@fractaloutlook I have a couple more local commits but frankly things changed so much, I haven't been active on it. What I used it for was a scanner that allows me to scan local grocery items UPC, an API then fetches product data and based on those responses it adds the item to my "Shopping List" on Workflowy. That broke a while ago and I've been swamped like hell since then to fix it.
I do have a little time coming up where I could fix some of it, but I think I will focus on getting base stuff going again (like add a new item) and ignore all the new bells and whistles. And then if you want you could go from there if you have a deeper need that is not covered. Or whats your use case? I could see if I can add that as well.
Also for some reason this notification went into my spam into which I almost never look, so great coonicidence I saw it after only 2 days.
@fractaloutlook I just checked and my local branch seems to be still working fine for at least adding new items (shopping list usage). The problem is the login, that is fully broken. I joined the Workflowy Slack and will poke them about it. There is some kind of API key, but not sure how to apply it. Maybe I can get some response from them next week about it and update it.
However, in the meantime, if you look into your cookies for a session id, you can use that to login with the PHP library still. Those (if memory serves right) have however a lifetime of 1 year from when you logged in and then expire, server side. If that is good enough for your use case right now, then go for that. I'll keep looking into the API key thing.
Hey hey! sorry I missed your Aug 14th reply entirely there... so busy busy... job hunting. Thanks so much for the replies here!
So the use case might even be something you'd use given your other phone app thing, if you're still using workflowy regularly! I've made an android app that takes control of the down-volume button such that when you hold it down it records audio, when you let go it stops, transcribes speech to text, and then updates a file in your google drive with the new voice note added as an item in the list with a timestamp. Each day has its own file in the folder, etc. This works even when your phone is LOCKED (if you have always on display on at least for the dim clock/notifications), and in real-time. You don't even have to take your phone out of your pocket if you talk loud enough. XD
I've currently got a Plugin for Obsidian that polls that file frequently and updates an Obsidian note, which is well and good if Obsidian is your jam for a daily... but my IDEAL case would be real-time updates to a specific branch in my workflowy, since it's more capable as a speedy little note-taker to use elsewise for a lot of reasons.
The app is really just for personal use, so I'm down with some janky stuff for sure -- something like grabbing a new session cookie now and again I can likely automate within the app. Two things tho:
1 - "look into your cookies for a session id" <--- web code is not my jam... where would I even look and how would I find this session ID?
2 - Would I need a session ID from the mobile browser or would a PC chrome one be ok also? Servers probably don't much care as long as it's a valid session, but wasn't sure if that would be tied to device or broswer, etc.
I (thankfully, really) can't smoke indoors at my computer desk, so I have to go walk outside. All of this has been effort spent to help me very easily and simply take notes on what I think about while smoking. There are many voice recorder apps, but none I've found that allow you to use your phone like a microcassette recorder without unlocking it, and I'll spend any amount of effort to make it easier for me to be lazy!
thanks again for being there and checking up on the api thing with them (pretty rad there's a workflowy slack you are allowed in? Is that the devs or just a community thing?)
cheers,
-Tim
@fractaloutlook Cheers Tim, I just had that experience of job hunting the last 3 months. Good luck!
Simple first: Workflowy slack is linked on https://blog.workflowy.com/workflowy-community/ where searching for slack you find it instantly. It's a user group kind of slack, but the devs are active in there. Also post new updates etc.
So to use it, you have to use my branch: https://github.com/ChristianRiesen/workflowy-php/tree/welcome-to-2020 In composer I simply add this at the root level:
"repositories": [
{
"type": "vcs",
"url": "https://github.com/christianriesen/workflowy-php"
}
],
And then select the branch
"johansatge/workflowy-php": "dev-welcome-to-2020",
That way I can test it as if it was really released. Keep in ind that will break once that gets merged, probably into a 1.0 version in here.
Then you need the session id. You can use the one from your browser. If you use chrome, be on the workflowy page and logged in already. Then hit F12, Go to the tab "application", open "cookies" on the left, then select the workflowy domain. There you see a list of cookies. Look for the one named "sessionid" and copy the value to the right. See the red box in the picture (blanked out so nobody can steal my stuff of course :) )
That id, save it somewhere and use it to connect with the library. Just directly supply it when instatiating the main class and it will work fine. It does have a shelflife though, which brings me to another point.
There is an "API", which as I'm told only allows you to add new items to an existing item, which can be accessed via an API key. You can generate that once and it will be valid as long as you don't explicitly delete it. However that's about as far as I know right now in useful info. I think I will make a mini library just for that in PHP as soon as I see how that's done. Which would solve your case and basically my case as well already. So keep an eye on here, I will post it as soon as I have it. But I need more info first and maybe I can get it next week when the workflowy devs are working again after a well deserved weekend.
And by the way, that sounds like an awesome app. Android? I would love to have that. Currently using a simple voice recorder (Zoom H1n) and transfer them by hand as I could not find a good app to do it on my phone. Then dump the audio files in a folder where a docker container grabs them, transcribes and does all the rest of the magic I want it to do. Pushing it to workflowy would actually be a wonderful use case! But yeah, without it running stable I didn't want to move to another workflow yet. So if you ever put your app out there, let me know, I'd pay good money for it too.
Ok, I think I just made the thing work and it's so damn simple @fractaloutlook
{
"new_bullet_id": "68a1e403-8b5d-4b5a-8c85-29ab2a13684b",
"new_bullet_title": "Title or basic line item in workflowy",
"new_bullet_note": "The description part that is below an item",
"save_location_url": "https://workflowy.com/#/abc123abc123"
}
For new_bullet_id
send a random UUIDv4, you can generate them however you want. In new_bullet_title
is the usual content of your item. If you just make a new one in Workflowy that's where you write the stuff into. With new_bullet_note
you have the description field, the extended stuff you can put below an item that moves with it if you do something to the item. You can leave that line off entirely if you want. And lastly save_location_url
which is the url from step 2, where you want the item to be added.
This will return a 200 code with a JSON that has what you sent in it, plus the url, and note from the save location item that you posted into. Also contains the url that that new item you generated in case that is useful for your use.
Don't think that even warrants it's own library right now. I just implemented it within my application (symfony framework API) within a simple class of a few lines. I suspect the API is sort of unofficial and used by integrations like Zappier so relative stable and they want to keep it working otherwise suddenly all the zappier stuff would stop working. Good enough for my use and probably also for yours. I mean you could even create an item per day, save that url somewhere and then have the notes of that day in that new day you created, etc. Lot's of possibilities with that one.
If you want a simple client library, let me know and I knock something out. Might make something anyways in case I can get more detailed documentation on the API and expand that out.
To give proper credit, this is not based on my genius, but I stumbled randomly over this repo that has the details in the code for doing that one thing: https://github.com/cameronapak/workflowy-inbox There is also a profile info, which is just the email when I call it so far.
@ChristianRiesen - yep that seems like it'll be easy enough to have each day be it's own bullet and generate a new one if there isn't one... which I can likely test for (if even just not getting a 200 code with JSON back)... It's 6:40am here so I gotta sleep, but I'll try to look into this further tomorrow or the next day! I knew that Zapier api was what I needed but I couldn't find a SOUL talking about it last time I went hunting (a couple years ago now I believe.)
Will get back to you if I make progress or for some reason get stuck! Thanks for all the help once again.
@fractaloutlook No Problem. I also came across it randomly, contacted that dev and he said he also randomly got an answer in the workflowy slack one day. So I will do some more digging in that direction to see if I can find more info. For now you can at least do the auto adding with a simple HTTP call and even remembre things you added yourself with a useful feature.
I will do exactly that myself with days and then notes attached to the days. I found a decent enough app Easy Voice Recorder, and its premium edition (still cheap) does stuff like silence skipping, format choices, recording even with screen off (though not as slick as your app with the button, still interested in that btw) and then auto upload to cloud providers like dropbox and google. So from there I'll do something to grab files from dropbox, throw them at a local whisper-asr installation and then take the result and put it into Workflowy, seperated by days.
Oh and another note: new_bullet_id
can also be left off, it will then generate it automagically on the server, so one less thing to worry about. The return answer has generated one included as well if wanted. So it just needs the title and the save location payload to run, the rest is all optional.
Thanks again sir... I got power-distracted into a a spiral of infinite nonsense (lol username checks out) trying to get a portfolio website up and rolling and everything that it entails. I will definitely be returning to this when I fire up the project once again hopefully this week.
Hello @johansatge First let me say thank you, your library worked out of the box and I managed to do with it what I wanted to. But the more I worked with it the more I stubbed my toes on limitations and work arounds I had to do in my code, so I just for fun started messing around with it for a little while.
Well that has balooned into a major rewrite: https://github.com/ChristianRiesen/workflowy-php/tree/welcome-to-2020
I even contacted the workflowy support to ask some pointed questions and they have been very helpful with answers, which led to some more good updates to the library.
The question now is would like me to make a PR with this rewrite to your repo, or would you prefer for me to have this as a completely new fork keeping it on my repo and make it under a new namespace and package name on packagist? I'm fine with either, but thought I'd ask you first since you did all the heavy lifting to make it work in the first place, for which I would like ot thank you again.
PS: It's not done yet, and I'd like to add some tests as well, but you can see it breaks pretty much everything in the old code.