Loomio
Wed 9 Oct 2019 11:09PM

API Questions?

JZ Jaime Zinn Public Seen by 287

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

Robert 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.

JZ

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!

RG

Robert Guthrie Mon 14 Oct 2019 6:19PM

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 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.

RG

Robert Guthrie Mon 21 Oct 2019 6:45PM

createdb loomio_development

should sort that for you

JZ

Jaime Zinn Tue 22 Oct 2019 10:03PM

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

H

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?

RG

Robert 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.

H

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?

RG

Robert 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

Load More