Route farmer SMS intents using OpenAI GPT-4.1-mini classification

Go to Workflow
0 views
Built by Alassane Alassane
Created on July 03, 2026

Description

Quick overview
This demo workflow receives an SMS-style request through a webhook, routes common farmer commands while it uses OpenAI for unknown messages. It is designed for African SMS-first farming contexts but can be adapted anywhere.

How it works
Receives an incoming SMS-style request through a webhook.
Normalizes the phone number, message text, timestamp, and provider message ID into a consistent format.
Passes the request through a demo farmer-lookup step. You can replace this with your own Google Sheets or other database.
For registered farmers, the workflow routes exact commands like RAIN, SEEDS, EQUIPMENT, PLANT, HARVEST, and REGISTER to dedicated reply paths.
For messages that do not match an exact command, the workflow asks OpenAI to identify the most relevant request type so it can choose the appropriate reply route.
Produces a Demo Preview - Not Sent reply. This template does not send real SMS messages or write to a live database.

Setup
Use the Webhook node's test URL to send an SMS-style payload while testing the workflow.
Add your OpenAI credential to AI Classify Unknown SMS.
Replace the backend nodes such as Lookup Farmer, supplier/rule lookup nodes, and Log nodes with your own Google Sheets or database actions.
Replace Send SMS Reply with your SMS provider node or HTTP Request node.
Test with messages such as RAIN, SEEDS, PLANT MAIZE, and a natural-language question before using a real farmer data.

Requirements
OpenAI credential for the AI fallback classification.
An SMS provider and farmer database are needed only when adapting the demo for live use.

Customization
You should adapt phone normalization, command words, languages, crop guidance, supplier sources, reply templates, and safety wording for your country or region.

Additional info
This template does not include any live SMS sending, farmer records, or credentials. It is best to review your outputs and safety rules before using it with real farmers.

Nodes Used (2)

Code
n8n-nodes-base.code
OpenAI
@n8n/n8n-nodes-langchain.openAi