Wed 9 Oct 2019 11:09PM

API Questions?

JZ Jaime Zinn Public Seen by 281

Howdy folks! I have a few questions about the Loomio API - if this isn't the right place, please let me know and I'll move it!

I'm a member of another group that uses Loomio to make decisions. Currently our leadership is manually text messaging members reminders to vote on proposals, and I was hoping to use Python, Twilio, and the Loomio API to automate this.

I've taken a look at the API documentation (https://help.loomio.org/en/dev_manual/using_the_api) and the rake routes (https://hackmd.loomio.io/s/HJmuX5IWl#), and see the proposals has a non_voters_count property. Is there any way I can access a list of members that have voted?

As a side note, I've also registered my python script (as described here 'https://github.com/loomio/loomio/pull/2980', 'https://github.com/loomio/loomio-oauth-sample'), but can only communicate with the API when I add my cookies to the pyoauth module.

Thank you!


Rob Guthrie Thu 10 Oct 2019 1:13AM

Hi @Jaime Zinn

Wow, this is quite timely, the idea of text messaging proposal reminders has come up in other places too.

I think this should be a core feature, admins/members should be able to enter their phone numbers into the group members directory, and members may be asked for their number when they join a group.

then you'd be able to send text reminders from the "send notification" screen.

Back to your question:

The Loomio API currently exists to support the main web client. We've actually just taken out the oauth stuff you mention because it was not being used by anyone and it's a security risk and app bloat if it's not being maintained.

However using the client API you can retrieve a list of people who have not voted on a poll via the announcements_controller#audience

end point.

You'd need to make the request passing your session cookie though.

I'm sorry, it's not documented and not setup for building external apps against. We tried that years ago but had no productive interest so we've been prioritising user experience over developer experience since then.


Jaime Zinn Mon 14 Oct 2019 4:21AM

Thanks @Rob Guthrie! This is very helpful to know.

Passing cookies works for now, glad to know I'm using the right method.

It doesn't look like the announcements_controller endpoint is exposed through the web API (https://www.loomio.org/api/v1/), so I may have to dive a bit more into ruby to create a plugin. Definitely link me in to the other conversations if you are able!


Rob Guthrie Mon 14 Oct 2019 6:19PM

Oh, it's exposed, all our functions are available via the client api.


Have you got a development environment setup

here's the output of rails routes, if that helps


Jaime Zinn Mon 21 Oct 2019 2:55PM

I haven't gotten the dev environment setup yet, having trouble with the rake step (FATAL: database "loomio_development" does not exist). I'll give a shot once I have a working dev environment.


Rob Guthrie Mon 21 Oct 2019 6:45PM

createdb loomio_development

should sort that for you


Jaime Zinn Tue 22 Oct 2019 10:03PM

Thanks Rob! I actually just needed a restart. :thinking: Now the real fun begins...


Hugi Ásgeirsson Fri 25 Oct 2019 9:54AM

it was not being used by anyone and it's a security risk and app bloat if it's not being maintained.

Ah. I think we are using it though, for our integration with Dreams @robertguthrie. I just think we haven’t noticed it because Dreams is currently disabled. We have a bot that creates threads and posts on about events from the Dreams event log. Do you it is affected by this? @krav our integration between Dreams and Talk uses OAuth to post on behalf of the bot, right?


Rob Guthrie Fri 25 Oct 2019 7:22PM

We can bring it back. The commit is not hard to reverse. We just need to be sure to fix all the warnings it was throwing.


Hugi Ásgeirsson Mon 27 Jan 2020 11:09PM

Checking in about this. We are about to start Dreams for Borderland 2020. Will this Loomio bot that posts to the API still work?


Rob Guthrie Mon 27 Jan 2020 11:12PM

The oauth stuff stuff is gone.. can you include a cookie with your api requests? If so then you can just include your session cookie with the api requests


Hugi Ásgeirsson Mon 27 Jan 2020 11:28PM

Hmmm, okay. Not sure how to do that off the bat. If you have any leads for what to do exactly I'd be grateful. Otherwise, we will have a crack at it with the guys who are taking over this weekend.


Rob Guthrie Mon 27 Jan 2020 11:41PM

Now that I'm home, I've read the code, it already uses normal user auth + setting cookies. So I expect it will just work. Happy to help if it does not, but I really expect it will be fine.

Thank goodness!


Hugi Ásgeirsson Mon 27 Jan 2020 11:47PM

Ah, relief! That's great news. Thank you for your help, yet again. 🤗


Rob Guthrie Mon 27 Jan 2020 11:52PM

It's a pleasure to see Loomio being used and support the users!
Great that removing the other auth stuff was the right move/had no cost, also cool to see an API client in the wild, I'll link to it from Loomio Help