Skip to main content
1

Install the CLI

npm install -g @jelou/cli
Verify the installation:
jelou --version
2

Authenticate

You need a personal access token (create one in the Jelou dashboard).
jelou login
# Paste your access token: ****
# ✓ Logged in
In CI you can pass the token directly: jelou login --token jfn_pat_your_token
3

Initialize a project

Create a directory and run jelou init:
mkdir query-customer && cd query-customer
jelou init
# ? Function slug: query-customer
# ? Description: Looks up customer information for the WhatsApp bot
# ? Create new or link existing? Create new
# ✓ Created query-customer
This generates the base files:
FilePurpose
index.tsYour main function
jelou.jsonProject configuration
deno.jsonSDK import map
.envLocal environment variables
4

Write your function

Replace the contents of index.ts with a function that looks up customers by phone:
index.ts
import { define, z } from "@jelou/functions";

export default define({
  name: "query-customer",
  description: "Looks up customer information by phone number for the support bot",
  input: z.object({
    phone: z.string().min(10).describe("Customer phone number"),
  }),
  output: z.object({
    name: z.string(),
    email: z.string(),
    plan: z.string(),
    balance: z.number(),
  }),
  handler: async (input, ctx) => {
    ctx.log("Looking up customer", {
      phone: input.phone,
      company: ctx.company.id,
    });

    const apiKey = ctx.env.get("CRM_API_KEY");
    const res = await fetch(
      `https://crm.example.com/api/customers?tel=${input.phone}`,
      { headers: { Authorization: `Bearer ${apiKey}` } },
    );
    const customer = await res.json();

    return {
      name: customer.name,
      email: customer.email,
      plan: customer.plan,
      balance: customer.balance,
    };
  },
});
5

Run locally

Start the development server:
jelou dev
# ▸ Listening on http://localhost:3000
# ▸ Watching for changes...
Your server reloads automatically when you edit files.
6

Test with curl

In another terminal, send a request:
curl -X POST http://localhost:3000 \
  -H "Content-Type: application/json" \
  -d '{"phone": "593987654321"}'
Response:
{
  "name": "Maria Garcia",
  "email": "[email protected]",
  "plan": "Premium",
  "balance": 150.00
}
You can also test the MCP endpoint at http://localhost:3000/mcp and the health check at http://localhost:3000/__health.
7

Configure secrets

Before deploying, add the environment variables your function needs:
jelou secrets set query-customer CRM_API_KEY=YOUR_CRM_API_KEY
# ✓ Set 1 secret
8

Deploy to production

jelou deploy
# ▸ Files: index.ts (1.2 KB), jelou.json (98 B), deno.json (65 B)
# ? Deploy query-customer? (Y/n) y
# ✓ Deployed to https://query-customer.fn.jelou.ai
Your function is now available in production. Jelou AI agents can invoke it as an MCP tool automatically.
9

Verify in production

curl -X POST https://query-customer.fn.jelou.ai \
  -H "Content-Type: application/json" \
  -d '{"phone": "593987654321"}'
Monitor logs in real time:
jelou logs query-customer

Next steps