Loomio
Wed 9 Oct 2019

API Questions?

JZ
Jaime Zinn Public Seen by 432

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!

RG

Rob Guthrie Thu 10 Oct 2019

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.

JZ

Jaime Zinn Mon 14 Oct 2019

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!

RG

Rob Guthrie Mon 14 Oct 2019

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

api/announcements#audience

Have you got a development environment setup

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

JZ

Jaime Zinn Mon 21 Oct 2019

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.

RG

Rob Guthrie Mon 21 Oct 2019

createdb loomio_development

should sort that for you

JZ

Jaime Zinn Tue 22 Oct 2019

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

HÁ

Hugi Ásgeirsson Fri 25 Oct 2019

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?

RG

Rob Guthrie Fri 25 Oct 2019

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.

HÁ

Hugi Ásgeirsson Mon 27 Jan

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

RG

Rob Guthrie Mon 27 Jan

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

HÁ

Hugi Ásgeirsson Mon 27 Jan

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.

RG

Rob Guthrie Mon 27 Jan

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!

HÁ

Hugi Ásgeirsson Mon 27 Jan

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

RG

Rob Guthrie Mon 27 Jan

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