New to farmOS and need help with api

Hi all, I’m new to farmOS. I’ve been given the task of taking over maintaining a farmOS site which has recently been migrated to a Ubuntu server.

The users stated they had an SMS service for texting to a number and they could log the number of eggs. Well since this has been migrated this feature no longer works and I have been thrown in the deep end.

I’ve been given access to a twilio service and told there you go. I have no idea where to even start, any help would be very appreciated.

2 Likes

Hi @PaulC welcome to the forum.

Is this farmOS 1.x or 2.x ? I remember someone on here having the same setup on 1.x

I know nothing about twilio, but I have played with a similar idea using Telegram and Node-Red.
8bfa3bdf435139891ad5e91118d69e9a578a3a6b.gif

With Telegram it can be a little more interactive than SMS using a bot.

Have you any access to the previous code used? or What language are you planning on using?

1 Like

Welcome @PaulC !

I think this might be the original code? Found by searching @Skipper here on the forum and Github :slight_smile: GitHub - Skipper-is/SMS-Egg-Logger: A TTGO T-Call ESP32 based egg recording platform for FarmOS

Seems like this worked by having a device actually receive the SMS text, process it in Python, and send to a PHP script (hosted elsewhere? maybe/maybe not on the farmOS server?) that then made the farmOS API request. As you mention this was also the v1 API.

I’m not familiar with Twilio, but using a service like this should eliminate the hardware/SMS processing complexity from the previous implementation. If Twilio can be configured to send an API request when receiving texts then maybe two options:

  1. Make a farmOS v2 module that exposes a custom API for receiving the Twilio request
  2. Use node-red as an intermediary service to receive Twilio request, add some processing logic & use the standard farmOS JSON:API

Telegram/chat looks promising too :slight_smile:

2 Likes

I used Twillio in the end, as the internet was too unreliable for my ESP32. There was another API that was hosted separately, and that could access farmOS API over Curl

4 Likes