import Itzam from "itzam";const itzam = new Itzam("YOUR_API_KEY");const response = await itzam.generateText({ input: "What is the capital of France?", workflowSlug: "my-workflow", type: "event", callback: { url: "https://example.com/webhook", headers: { Authorization: "your_secret_key", }, customProperties: { user_id: "user_123", }, },});console.log(response.message); // "Event queued"
This will send a POST request to the URL you provide after the generation is complete. You can also add headers and custom properties to the request.This is the body of the request:
Copy
// TEXT GENERATION{ "text": "The capital of France is Paris", "metadata": { // The standard metadata object... }, "customProperties": { // Any other custom properties you added "user_id": "user_123", },}// OBJECT GENERATION{ "object": { // The generated object }, "metadata": { // The standard metadata object... }, "customProperties": { // Any other custom properties you added "user_id": "user_123", },}