API Questions?
![JZ](/rails/active_storage/representations/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBeTJiRUE9PSIsImV4cCI6bnVsbCwicHVyIjoiYmxvYl9pZCJ9fQ==--9fd2c70aa3452e5ee7297c732d73d56272d02098/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDRG9MWm05eWJXRjBTU0lJYW5CbkJqb0dSVlE2RkhKbGMybDZaVjkwYjE5c2FXMXBkRnNIYVFHQWFRR0FPZ3B6WVhabGNuc0hPZ3h4ZFdGc2FYUjVhVlU2Q25OMGNtbHdWQT09IiwiZXhwIjpudWxsLCJwdXIiOiJ2YXJpYXRpb24ifX0=--bee53b50eefebbfaf3427852775dd64daaceca76/IMG_20220423_190810_293.jpg)
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!
![JZ](/rails/active_storage/representations/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBeTJiRUE9PSIsImV4cCI6bnVsbCwicHVyIjoiYmxvYl9pZCJ9fQ==--9fd2c70aa3452e5ee7297c732d73d56272d02098/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDRG9MWm05eWJXRjBTU0lJYW5CbkJqb0dSVlE2RkhKbGMybDZaVjkwYjE5c2FXMXBkRnNIYVFHQWFRR0FPZ3B6WVhabGNuc0hPZ3h4ZFdGc2FYUjVhVlU2Q25OMGNtbHdWQT09IiwiZXhwIjpudWxsLCJwdXIiOiJ2YXJpYXRpb24ifX0=--bee53b50eefebbfaf3427852775dd64daaceca76/IMG_20220423_190810_293.jpg)
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](/rails/active_storage/representations/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBK0xZRVE9PSIsImV4cCI6bnVsbCwicHVyIjoiYmxvYl9pZCJ9fQ==--7a581de88c41bcec9b40d2bb53a4dc7ab8efdb69/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDRG9MWm05eWJXRjBTU0lJYW5CbkJqb0dSVlE2RkhKbGMybDZaVjkwYjE5c2FXMXBkRnNIYVFHQWFRR0FPZ3B6WVhabGNuc0hPZ3h4ZFdGc2FYUjVhVlU2Q25OMGNtbHdWQT09IiwiZXhwIjpudWxsLCJwdXIiOiJ2YXJpYXRpb24ifX0=--bee53b50eefebbfaf3427852775dd64daaceca76/IMG_4141.CR2.jpg)
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](/rails/active_storage/representations/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBeTJiRUE9PSIsImV4cCI6bnVsbCwicHVyIjoiYmxvYl9pZCJ9fQ==--9fd2c70aa3452e5ee7297c732d73d56272d02098/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDRG9MWm05eWJXRjBTU0lJYW5CbkJqb0dSVlE2RkhKbGMybDZaVjkwYjE5c2FXMXBkRnNIYVFHQWFRR0FPZ3B6WVhabGNuc0hPZ3h4ZFdGc2FYUjVhVlU2Q25OMGNtbHdWQT09IiwiZXhwIjpudWxsLCJwdXIiOiJ2YXJpYXRpb24ifX0=--bee53b50eefebbfaf3427852775dd64daaceca76/IMG_20220423_190810_293.jpg)
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](/rails/active_storage/representations/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBK0xZRVE9PSIsImV4cCI6bnVsbCwicHVyIjoiYmxvYl9pZCJ9fQ==--7a581de88c41bcec9b40d2bb53a4dc7ab8efdb69/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDRG9MWm05eWJXRjBTU0lJYW5CbkJqb0dSVlE2RkhKbGMybDZaVjkwYjE5c2FXMXBkRnNIYVFHQWFRR0FPZ3B6WVhabGNuc0hPZ3h4ZFdGc2FYUjVhVlU2Q25OMGNtbHdWQT09IiwiZXhwIjpudWxsLCJwdXIiOiJ2YXJpYXRpb24ifX0=--bee53b50eefebbfaf3427852775dd64daaceca76/IMG_4141.CR2.jpg)
Robert Guthrie Mon 21 Oct 2019 6:45PM
createdb loomio_development
should sort that for you
![JZ](/rails/active_storage/representations/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBeTJiRUE9PSIsImV4cCI6bnVsbCwicHVyIjoiYmxvYl9pZCJ9fQ==--9fd2c70aa3452e5ee7297c732d73d56272d02098/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDRG9MWm05eWJXRjBTU0lJYW5CbkJqb0dSVlE2RkhKbGMybDZaVjkwYjE5c2FXMXBkRnNIYVFHQWFRR0FPZ3B6WVhabGNuc0hPZ3h4ZFdGc2FYUjVhVlU2Q25OMGNtbHdWQT09IiwiZXhwIjpudWxsLCJwdXIiOiJ2YXJpYXRpb24ifX0=--bee53b50eefebbfaf3427852775dd64daaceca76/IMG_20220423_190810_293.jpg)
Jaime Zinn Tue 22 Oct 2019 10:03PM
Thanks Rob! I actually just needed a restart. :thinking: Now the real fun begins...
![H](/rails/active_storage/representations/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBeUlYRUE9PSIsImV4cCI6bnVsbCwicHVyIjoiYmxvYl9pZCJ9fQ==--e10e7aa4071ec9b71a7fef793c4e863050a9c38c/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDRG9MWm05eWJXRjBTU0lKYW5CbFp3WTZCa1ZVT2hSeVpYTnBlbVZmZEc5ZmJHbHRhWFJiQjJrQmdHa0JnRG9LYzJGMlpYSjdCem9NY1hWaGJHbDBlV2xWT2dwemRISnBjRlE9IiwiZXhwIjpudWxsLCJwdXIiOiJ2YXJpYXRpb24ifX0=--e579049eb7f20fc1070cc24f3215f2949d184302/IMG_3074.jpeg)
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](/rails/active_storage/representations/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBK0xZRVE9PSIsImV4cCI6bnVsbCwicHVyIjoiYmxvYl9pZCJ9fQ==--7a581de88c41bcec9b40d2bb53a4dc7ab8efdb69/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDRG9MWm05eWJXRjBTU0lJYW5CbkJqb0dSVlE2RkhKbGMybDZaVjkwYjE5c2FXMXBkRnNIYVFHQWFRR0FPZ3B6WVhabGNuc0hPZ3h4ZFdGc2FYUjVhVlU2Q25OMGNtbHdWQT09IiwiZXhwIjpudWxsLCJwdXIiOiJ2YXJpYXRpb24ifX0=--bee53b50eefebbfaf3427852775dd64daaceca76/IMG_4141.CR2.jpg)
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](/rails/active_storage/representations/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBeUlYRUE9PSIsImV4cCI6bnVsbCwicHVyIjoiYmxvYl9pZCJ9fQ==--e10e7aa4071ec9b71a7fef793c4e863050a9c38c/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDRG9MWm05eWJXRjBTU0lKYW5CbFp3WTZCa1ZVT2hSeVpYTnBlbVZmZEc5ZmJHbHRhWFJiQjJrQmdHa0JnRG9LYzJGMlpYSjdCem9NY1hWaGJHbDBlV2xWT2dwemRISnBjRlE9IiwiZXhwIjpudWxsLCJwdXIiOiJ2YXJpYXRpb24ifX0=--e579049eb7f20fc1070cc24f3215f2949d184302/IMG_3074.jpeg)
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](/rails/active_storage/representations/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBK0xZRVE9PSIsImV4cCI6bnVsbCwicHVyIjoiYmxvYl9pZCJ9fQ==--7a581de88c41bcec9b40d2bb53a4dc7ab8efdb69/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDRG9MWm05eWJXRjBTU0lJYW5CbkJqb0dSVlE2RkhKbGMybDZaVjkwYjE5c2FXMXBkRnNIYVFHQWFRR0FPZ3B6WVhabGNuc0hPZ3h4ZFdGc2FYUjVhVlU2Q25OMGNtbHdWQT09IiwiZXhwIjpudWxsLCJwdXIiOiJ2YXJpYXRpb24ifX0=--bee53b50eefebbfaf3427852775dd64daaceca76/IMG_4141.CR2.jpg)
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
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.