diff --git a/packages/asana/snippets.json b/packages/asana/snippets.json new file mode 100644 index 0000000000..fafc0718c9 --- /dev/null +++ b/packages/asana/snippets.json @@ -0,0 +1,66 @@ +{ + "CREATE": { + "Add Task to Section of Project": { + "description": "Adds a Task to a Section of a Project.", + "code": "" + }, + "Create Comment/Story": { + "description": "Adds a comment or story to a task.", + "code": "// Add a comment / story to a task.\ncreateTaskStory(\n // 1) The task's globally unique id.\n $.data.taskGid,\n {\n // 2) The comment body (HTML supported when html_text is used).\n text: 'Status update: imported from the upstream system.',\n }\n);" + }, + "Create Duplicate Task": { + "description": "Duplicates an existing task.", + "code": "" + }, + "Create Project": { + "description": "Adds a new project.", + "code": "" + }, + "Create Section": { + "description": "Creates a new section within a project.", + "code": "" + }, + "Create Task": { + "description": "Creates a new task in Asana with specified details.", + "code": "// Create a new task.\ncreateTask({\n // The task's title.\n name: 'Follow up with patient',\n // Long-form description (optional).\n notes: `Imported from upstream system on ${new Date().toISOString()}`,\n // Workspace gid this task lives in.\n workspace: $.configuration.workspaceGid,\n // Optional: place the task into a project on creation.\n projects: [$.data.projectGid],\n // Optional: assign to a user gid.\n assignee: $.data.assigneeGid,\n // Optional ISO date string.\n due_on: '2026-06-01',\n});" + }, + "Create Task From Template": { + "description": "Creates a new task in Asana from a selected template.", + "code": "" + }, + "Update Task": { + "description": "Updates multiple properties of an existing Asana task.", + "code": "// Update properties on an existing task.\nupdateTask(\n // 1) Task gid.\n $.data.taskGid,\n // 2) Fields to change.\n {\n name: 'Updated task title',\n completed: true,\n notes: 'Closed after upstream sync.',\n }\n);" + }, + "API Request (Beta)": { + "description": "Raw HTTP request with authentication.", + "code": "// Make an arbitrary request against the Asana API.\n// Path is relative to the Asana base URL.\nrequest('/workspaces', {\n method: 'GET',\n query: { limit: 10 },\n});" + } + }, + "SEARCH": { + "Find All Tasks From Project": { + "description": "Searches for all tasks in a specific project with optional filters.", + "code": "// List tasks in a project.\ngetTasks(\n // 1) Project gid.\n $.data.projectGid,\n // 2) Query params.\n {\n // Fields to return per task.\n opt_fields: 'name,notes,assignee,completed,due_on',\n // Cap the result size.\n limit: 100,\n }\n);" + }, + "Find Project": { + "description": "Finds an existing project.", + "code": "" + }, + "Find Section in Project": { + "description": "Finds an existing section within a workspace project.", + "code": "" + }, + "Find Task Comments": { + "description": "Finds comments for a specific task.", + "code": "" + }, + "Find Tasks in Workspace": { + "description": "Searches for tasks in a workspace using Asana's search API (premium only).", + "code": "// Search tasks across a workspace using Asana's typeahead/search API.\n// Note: this endpoint requires a premium Asana plan.\nsearchTask(\n // 1) The search term (matches task name).\n $.data.searchTerm,\n // 2) Query params (assignee, completed, etc).\n {\n 'assignee.any': $.data.assigneeGid,\n completed: false,\n }\n);" + }, + "Find User": { + "description": "Finds an existing user of your Asana account.", + "code": "" + } + } +} diff --git a/packages/bigquery/snippets.json b/packages/bigquery/snippets.json new file mode 100644 index 0000000000..3fb4f52223 --- /dev/null +++ b/packages/bigquery/snippets.json @@ -0,0 +1,18 @@ +{ + "CREATE": { + "Insert Row": { + "description": "Add a row to a BigQuery table.", + "code": "// Load file(s) into a BigQuery table.\n// The adaptor batches rows from disk; for one-off row inserts you typically\n// write the row(s) to a local file first and point `load` at it.\nload(\n // 1) Path to the local directory containing files to load.\n './tmp/files',\n // 2) GCP project id.\n $.configuration.projectId,\n // 3) Dataset id.\n 'my_dataset',\n // 4) Target table id.\n 'my_table',\n {\n // Column types (BQ schema string).\n schema: 'name:STRING,email:STRING,amount:NUMERIC',\n // Append rather than replace.\n writeDisposition: 'WRITE_APPEND',\n // Skip header row(s) if loading CSV.\n skipLeadingRows: 1,\n createDisposition: 'CREATE_IF_NEEDED',\n }\n);" + } + }, + "SEARCH": { + "Find Row": { + "description": "Find a specific row in a BigQuery table.", + "code": "" + }, + "Run a Query": { + "description": "Execute a SQL query against your BigQuery dataset.", + "code": "" + } + } +} diff --git a/packages/chatgpt/snippets.json b/packages/chatgpt/snippets.json new file mode 100644 index 0000000000..77f762db68 --- /dev/null +++ b/packages/chatgpt/snippets.json @@ -0,0 +1,110 @@ +{ + "CREATE": { + "Analyze Image Content With Vision (Legacy)": { + "description": "Upload an image and send a message or question about it. Powered by Chat Completions API.", + "code": "// Ask a question about an image via Chat Completions.\n// Override `messages` to attach an image part alongside the text.\nprompt(null, {\n model: 'gpt-4o-mini',\n messages: [\n {\n role: 'user',\n content: [\n { type: 'text', text: 'Describe what is happening in this image.' },\n { type: 'image_url', image_url: { url: $.data.imageUrl } },\n ],\n },\n ],\n});" + }, + "Analyze Images": { + "description": "(Recommended) Upload an image(s) and send a message or question about it. Powered by Responses API.", + "code": "// Analyze an image via the Responses API.\n// Override `input` to attach an image alongside the text prompt.\ndeepResearch(null, {\n model: 'gpt-4o',\n // No web search needed for pure image analysis.\n tools: [],\n input: [\n {\n role: 'user',\n content: [\n { type: 'input_text', text: 'Describe what is happening in this image.' },\n { type: 'input_image', image_url: $.data.imageUrl },\n ],\n },\n ],\n});" + }, + "Analyze Text": { + "description": "(Recommended) Summarize, classify, and analyze text. Powered by Responses API.", + "code": "// Analyze a block of text via the Responses API.\ndeepResearch(\n `Analyze the following text. Return the key themes, tone and any action items.\\n\\nTEXT:\\n${$.data.text}`,\n {\n model: 'gpt-4o',\n // No web search needed; disable the default tool.\n tools: [],\n }\n);" + }, + "Analyze Text Sentiment (Legacy)": { + "description": "Generate an analysis of the overall sentiment of a block of text. Powered by Chat Completions API.", + "code": "// Return a sentiment label + score for a block of text.\nprompt(\n `Rate the sentiment of the text below. Reply as JSON:\\n{ \"label\": \"positive\" | \"neutral\" | \"negative\", \"score\": number between -1 and 1 }\\n\\nTEXT:\\n${$.data.text}`,\n {\n model: 'gpt-4o-mini',\n temperature: 0,\n // Force the model to emit valid JSON.\n response_format: { type: 'json_object' },\n }\n);" + }, + "Check Moderations": { + "description": "Classifies if text is potentially harmful.", + "code": "" + }, + "Classify Text (Legacy)": { + "description": "Classify your text into one of your provided categories. Powered by Chat Completions API.", + "code": "// Classify text into one of the supplied categories.\nconst categories = ['billing', 'support', 'sales', 'other'];\n\nprompt(\n `Pick the single best category for the message below. Reply with the\\ncategory string only, nothing else.\\n\\nCATEGORIES: ${categories.join(', ')}\\n\\nMESSAGE:\\n${$.data.message}`,\n {\n model: 'gpt-4o-mini',\n temperature: 0,\n }\n);" + }, + "Conversation": { + "description": "(Recommended) Send a chat to OpenAI, optionally storing messages for continuous conversation. This enhanced action can also help with web search, file search, and advanced tooling such as MCP. Powered by Responses API.", + "code": "// Send a chat turn via the Responses API, with tools enabled.\n// Default tool is web_search_preview; override `tools` to use file_search, MCP, etc.\ndeepResearch(\n $.data.userMessage,\n {\n model: 'gpt-4o',\n tools: [{ type: 'web_search_preview' }],\n }\n);" + }, + "Conversation (Legacy)": { + "description": "Sends a Chat to OpenAI and generates a Completion, optionally storing messages as we do. Powered by Chat Completions API.", + "code": "// Multi-turn chat via Chat Completions. Provide the full message history.\n// `prompt`'s first arg is ignored when `messages` is overridden.\nprompt(null, {\n model: 'gpt-4o-mini',\n messages: [\n { role: 'system', content: 'You are a concise assistant.' },\n ...($.state.history || []),\n { role: 'user', content: $.data.userMessage },\n ],\n temperature: 0.5,\n});" + }, + "Convert Text to Speech": { + "description": "Converts a given text to speech.", + "code": "" + }, + "Create Embedding": { + "description": "Generate vector embeddings for text input.", + "code": "" + }, + "Create Image Edit": { + "description": "Creates a new image by editing an existing image with a prompt.", + "code": "" + }, + "Create Transcription": { + "description": "Creates a new transcription, using Whisper, from an audio or video file.", + "code": "" + }, + "Create Translation": { + "description": "Creates a new translation.", + "code": "" + }, + "Create Video": { + "description": "Create a new video generation job using Sora. Returns a video job ID that can be used to check the render status.", + "code": "" + }, + "Extract Structured Data": { + "description": "(Recommended) Improved structured data extraction with better formatting options and more reliable schema adherence. Powered by Responses API.", + "code": "// Extract structured fields via the Responses API, constrained to a JSON schema.\ndeepResearch(\n `Extract the contact details from the message below.\\n\\nMESSAGE:\\n${$.data.message}`,\n {\n model: 'gpt-4o',\n tools: [],\n text: {\n format: {\n type: 'json_schema',\n name: 'contact',\n schema: {\n type: 'object',\n properties: {\n name: { type: 'string' },\n email: { type: 'string' },\n phone: { type: 'string' },\n },\n required: ['name'],\n additionalProperties: false,\n },\n },\n },\n }\n);" + }, + "Extract Structured Data (Legacy)": { + "description": "Sends unstructured text and returns structured data using OpenAI's \"Function Calling\" capability. Powered by Chat Completions API.", + "code": "// Extract structured fields from unstructured text via Chat Completions.\n// The model is constrained to a JSON schema; result lands on state.data.\nprompt(\n `Extract the contact details from the message below.\\n\\nMESSAGE:\\n${$.data.message}`,\n {\n model: 'gpt-4o-mini',\n temperature: 0,\n response_format: {\n type: 'json_schema',\n json_schema: {\n name: 'contact',\n schema: {\n type: 'object',\n properties: {\n name: { type: 'string' },\n email: { type: 'string' },\n phone: { type: 'string' },\n },\n required: ['name'],\n additionalProperties: false,\n },\n },\n },\n }\n);" + }, + "Generate An Image": { + "description": "Generates an image using a relevant OpenAI model.", + "code": "" + }, + "Send Prompt": { + "description": "Sends a prompt to OpenAI and generates a completion. Note: this uses the legacy OpenAI Completions API. We recommend using Conversation or Conversation With Assistant actions instead, which are powered by the latest OpenAI APIs.", + "code": "// Send a free-form prompt. Note: this adaptor calls Chat Completions under\n// the hood, not the legacy text-completions endpoint.\nprompt(\n `What are three risks to watch for in the following plan?\\n\\n${$.data.plan}`,\n {\n model: 'gpt-4o-mini',\n temperature: 0.5,\n }\n);" + }, + "Summarize Text (Legacy)": { + "description": "Enter a block of text and generate a summary. Powered by Chat Completions API.", + "code": "// Summarize a chunk of text.\nprompt(\n `Summarize the text below in 3 short bullet points.\\n\\nTEXT:\\n${$.data.text}`,\n {\n model: 'gpt-4o-mini',\n temperature: 0.2,\n }\n);" + }, + "Write an Email": { + "description": "Writes the content of an email based on your provided prompt for use in a subsequent step.", + "code": "// Draft an email body for use in a later send step.\nprompt(\n `Write a friendly email to ${$.data.recipientName} confirming their\\nappointment on ${$.data.appointmentDate}. Sign it from \\\"OpenFn Team\\\".`,\n {\n model: 'gpt-4o-mini',\n temperature: 0.7,\n }\n);" + }, + "API Request (Beta)": { + "description": "This is an advanced action which makes a raw HTTP request that includes this integration's authentication.", + "code": "" + } + }, + "SEARCH": { + "Find Conversation": { + "description": "Find a conversation for native OpenAI conversation management.", + "code": "" + }, + "Find File": { + "description": "Finds a file by filename. Optionally, create a file if none are found.", + "code": "" + }, + "Find Response": { + "description": "Find a stored Responses API result by response ID for audit trails and debugging.", + "code": "" + }, + "Get Video": { + "description": "Retrieve the status and details of a video generation job created with Sora. Use this to check if a video is ready for download.", + "code": "" + }, + "Search Embeddings": { + "description": "This best matches a query string (like \"big animal\") to a list of document strings (like \"mouse\", \"cat\", \"buffalo\", and \"blue whale\").", + "code": "" + } + } +} diff --git a/packages/claude/snippets.json b/packages/claude/snippets.json new file mode 100644 index 0000000000..24535f5e50 --- /dev/null +++ b/packages/claude/snippets.json @@ -0,0 +1,30 @@ +{ + "CREATE": { + "Delete File": { + "description": "Delete a file from Anthropic", + "code": "" + }, + "Download File": { + "description": "Download file content from Anthropic", + "code": "" + }, + "Send Message": { + "description": "Sends a message to Claude and the model generates the next message in the conversation, storing the messages as you go.", + "code": "// Send a prompt to Claude.\n// The model's reply is written to state.data.\nprompt(\n // 1) The message text. Reference upstream state with $.\n `Summarize this text: ${JSON.stringify($.data)}`,\n {\n // 2) Model id. Defaults to the latest Sonnet if omitted.\n model: 'claude-sonnet-4-6',\n // 3) Maximum tokens to generate in the reply.\n max_tokens: 1024,\n // 4) 0.0 = analytical / deterministic, 1.0 = creative.\n temperature: 0.7,\n }\n);" + }, + "Upload File": { + "description": "Upload a file to Anthropic", + "code": "" + } + }, + "SEARCH": { + "Get File Metadata": { + "description": "Get metadata for a specific file", + "code": "" + }, + "List Files": { + "description": "List all files uploaded to Anthropic", + "code": "" + } + } +} diff --git a/packages/dynamics/snippets.json b/packages/dynamics/snippets.json new file mode 100644 index 0000000000..2f8c29c931 --- /dev/null +++ b/packages/dynamics/snippets.json @@ -0,0 +1,102 @@ +{ + "CREATE": { + "Create Account": { + "description": "Creates a new account.", + "code": "// Create an Account record in Dynamics.\ncreateEntity({\n // Plural-cased Dataverse entity set.\n entityName: 'accounts',\n body: {\n name: $.data.name,\n emailaddress1: $.data.email,\n telephone1: $.data.phone,\n },\n});" + }, + "Create Case/Incident": { + "description": "Creates a new case/incident.", + "code": "// Create a Case (incident) record.\ncreateEntity({\n entityName: 'incidents',\n body: {\n title: $.data.title,\n description: $.data.description,\n // Lookup back to the parent account using an @odata.bind reference.\n 'customerid_account@odata.bind': `/accounts(${$.data.accountId})`,\n },\n});" + }, + "Create Contact": { + "description": "Creates a new contact.", + "code": "// Create a Contact record.\ncreateEntity({\n entityName: 'contacts',\n body: {\n firstname: $.data.firstName,\n lastname: $.data.lastName,\n emailaddress1: $.data.email,\n },\n});" + }, + "Create Custom Entity": { + "description": "Creates a new custom entity record.", + "code": "// Create a record in a custom entity. Use the entity's plural set name.\ncreateEntity({\n entityName: 'my_custom_entities',\n body: $.data.record,\n});" + }, + "Create Invoice": { + "description": "Creates a new invoice.", + "code": "// Create an Invoice.\ncreateEntity({\n entityName: 'invoices',\n body: {\n name: $.data.invoiceName,\n 'customerid_account@odata.bind': `/accounts(${$.data.accountId})`,\n totalamount: $.data.total,\n },\n});" + }, + "Create Lead": { + "description": "Creates a new lead.", + "code": "// Create a Lead.\ncreateEntity({\n entityName: 'leads',\n body: {\n firstname: $.data.firstName,\n lastname: $.data.lastName,\n emailaddress1: $.data.email,\n subject: $.data.subject,\n },\n});" + }, + "Create Opportunity": { + "description": "Creates a new opportunity.", + "code": "// Create an Opportunity.\ncreateEntity({\n entityName: 'opportunities',\n body: {\n name: $.data.opportunityName,\n 'customerid_account@odata.bind': `/accounts(${$.data.accountId})`,\n estimatedvalue: $.data.estimatedValue,\n },\n});" + }, + "Create Order": { + "description": "Creates a new order.", + "code": "// Create a Sales Order.\ncreateEntity({\n entityName: 'salesorders',\n body: {\n name: $.data.orderName,\n 'customerid_account@odata.bind': `/accounts(${$.data.accountId})`,\n },\n});" + }, + "Update Account": { + "description": "Updates an account.", + "code": "// Update fields on an existing Account.\nupdateEntity({\n entityName: 'accounts',\n // The record's GUID.\n entityId: $.data.accountId,\n body: {\n telephone1: $.data.phone,\n emailaddress1: $.data.email,\n },\n});" + }, + "Update Contact": { + "description": "Updates a contact.", + "code": "// Update fields on an existing Contact.\nupdateEntity({\n entityName: 'contacts',\n entityId: $.data.contactId,\n body: {\n emailaddress1: $.data.email,\n telephone1: $.data.phone,\n },\n});" + }, + "Update Custom Entity": { + "description": "Updates a custom entity.", + "code": "// Update a custom entity record.\nupdateEntity({\n entityName: 'my_custom_entities',\n entityId: $.data.recordId,\n body: $.data.fields,\n});" + }, + "Update Lead": { + "description": "Updates a lead.", + "code": "// Update fields on an existing Lead.\nupdateEntity({\n entityName: 'leads',\n entityId: $.data.leadId,\n body: {\n statuscode: 3, // qualified\n emailaddress1: $.data.email,\n },\n});" + }, + "Update Record": { + "description": "Updates an existing record.", + "code": "// Update a record on any entity, by GUID.\nupdateEntity({\n entityName: $.data.entityName,\n entityId: $.data.recordId,\n body: $.data.fields,\n});" + } + }, + "SEARCH": { + "Find Account": { + "description": "Finds an account by name.", + "code": "// Look up Accounts by name using an OData filter.\nquery({\n entityName: 'accounts',\n // OData $filter; quote string values with single quotes.\n filter: `name eq '${$.data.name}'`,\n // Only return the columns we care about.\n select: ['accountid', 'name', 'emailaddress1'],\n});" + }, + "Find Campaign Response": { + "description": "Finds a campaign response.", + "code": "// Look up Campaign Responses.\nquery({\n entityName: 'campaignresponses',\n filter: `_regardingobjectid_value eq ${$.data.campaignId}`,\n});" + }, + "Find Contact": { + "description": "Finds a contact by email address or other searchable field.", + "code": "// Look up a Contact by email.\nquery({\n entityName: 'contacts',\n filter: `emailaddress1 eq '${$.data.email}'`,\n select: ['contactid', 'firstname', 'lastname', 'emailaddress1'],\n});" + }, + "Find Custom Entity": { + "description": "Finds a custom entity.", + "code": "// Look up records on a custom entity.\nquery({\n entityName: 'my_custom_entities',\n filter: `my_externalid eq '${$.data.externalId}'`,\n});" + }, + "Find Invoice": { + "description": "Finds an invoice.", + "code": "// Look up an Invoice by name or number.\nquery({\n entityName: 'invoices',\n filter: `name eq '${$.data.invoiceName}'`,\n});" + }, + "Find Lead": { + "description": "Finds a lead by email address or other searchable field.", + "code": "// Look up a Lead by email.\nquery({\n entityName: 'leads',\n filter: `emailaddress1 eq '${$.data.email}'`,\n});" + }, + "Find Opportunity": { + "description": "Finds an opportunity by subject or other searchable field.", + "code": "// Look up an Opportunity by name.\nquery({\n entityName: 'opportunities',\n filter: `name eq '${$.data.opportunityName}'`,\n});" + }, + "Find or Create Account": { + "description": "Finds an account by name.", + "code": "" + }, + "Find or Create Custom Entity": { + "description": "Finds a custom entity.", + "code": "" + }, + "Find or Create Lead": { + "description": "Finds a lead.", + "code": "" + }, + "Find or Create Order": { + "description": "Finds an order.", + "code": "" + } + } +} diff --git a/packages/facebook/snippets.json b/packages/facebook/snippets.json new file mode 100644 index 0000000000..768001a172 --- /dev/null +++ b/packages/facebook/snippets.json @@ -0,0 +1,24 @@ +{ + "CREATE": { + "Change Page Profile Photo": { + "description": "Changes the profile picture of a Facebook Page.", + "code": "" + }, + "Create Page Photo": { + "description": "Uploads a photo to your Facebook Page and posts it to the stream.", + "code": "" + }, + "Create Page Post": { + "description": "Create a new page \"stream\" post on a page.", + "code": "// Post a message to your Facebook Page feed.\n// The postMessage helper wraps the Graph API /{page-id}/feed endpoint.\npostMessage({\n recipient: { id: $.configuration.pageId },\n message: {\n text: `New update from OpenFn: ${$.data.summary}`,\n },\n});" + }, + "Create Page Video": { + "description": "Uploads a video to your Facebook Page and posts it to the stream.", + "code": "" + }, + "Page Post Insights": { + "description": "Generates page post insights.", + "code": "" + } + } +} diff --git a/packages/flutterwave/snippets.json b/packages/flutterwave/snippets.json new file mode 100644 index 0000000000..c47d1a59c5 --- /dev/null +++ b/packages/flutterwave/snippets.json @@ -0,0 +1,26 @@ +{ + "CREATE": { + "Create Payment Plan": { + "description": "Creates a new payment plan.", + "code": "" + }, + "Create Transfer": { + "description": "Creates a new transfer.", + "code": "" + }, + "API Request (Beta)": { + "description": "Raw HTTP request with authentication.", + "code": "" + } + }, + "SEARCH": { + "Find Transaction": { + "description": "Find a transaction by the transaction id or payment reference.", + "code": "" + }, + "Find Transfer": { + "description": "Find a transfer by the transfer reference.", + "code": "" + } + } +} diff --git a/packages/gemini/snippets.json b/packages/gemini/snippets.json new file mode 100644 index 0000000000..fb2bdbeb31 --- /dev/null +++ b/packages/gemini/snippets.json @@ -0,0 +1,40 @@ +{ + "CREATE": { + "Conversation": { + "description": "Sends a chat message, optionally storing messages as you go.", + "code": "// Multi-turn chat. Pass an array of Content objects as the first argument;\n// the adaptor forwards it as `contents` to generateContent.\nprompt(\n [\n { role: 'user', parts: [{ text: 'Hi there!' }] },\n { role: 'model', parts: [{ text: 'Hello — how can I help?' }] },\n { role: 'user', parts: [{ text: $.data.userMessage }] },\n ],\n {\n model: 'gemini-2.5-flash',\n }\n);" + }, + "Generate Audio": { + "description": "Generate audio from text using Gemini text-to-speech models. Useful for voice responses and audio prompts.", + "code": "" + }, + "Generate Image": { + "description": "Generate an image from a text prompt using Gemini or Imagen models.", + "code": "// Generate an image from a text prompt.\n// The base64-encoded image is written to state.\ngenerateImage(\n `A flat-design illustration of: ${$.data.subject}`,\n {\n // Image-capable model — defaults to gemini-3-pro-image-preview.\n model: 'gemini-3-pro-image-preview',\n // Output size hint (e.g. '1K', '2K').\n imageSize: '1K',\n // Aspect ratio: '1:1', '16:9', '9:16', '4:3', '3:4'.\n aspectRatio: '16:9',\n }\n);" + }, + "Generate Video": { + "description": "Generate a video from a text prompt using Veo models.", + "code": "" + }, + "Send Prompt": { + "description": "Sends a prompt and generates a response.", + "code": "// Send a prompt to Gemini.\n// The text reply is written to state.data.response.\nprompt(\n `Summarize this text: ${JSON.stringify($.data)}`,\n {\n // Gemini model id (see https://ai.google.dev/gemini-api/docs/models).\n model: 'gemini-2.5-flash',\n config: {\n temperature: 0.7,\n },\n }\n);" + }, + "Understand Audio": { + "description": "Generate a text response from an audio clip using Gemini models. Useful for summaries, transcripts, and questions about the audio.", + "code": "" + }, + "Understand Document": { + "description": "Generate a text response from a document using Gemini models. Useful for summaries, key points, and questions about the document.", + "code": "" + }, + "Understand Video": { + "description": "Generate a text response from a video using Gemini models. Useful for summaries, key events, and Q&A about the video.", + "code": "" + }, + "Understand YouTube Video": { + "description": "Generate a text response from a YouTube video using Gemini models. Useful for summaries, key moments, and questions about the video.", + "code": "" + } + } +} diff --git a/packages/gmail/snippets.json b/packages/gmail/snippets.json new file mode 100644 index 0000000000..d18040f2d6 --- /dev/null +++ b/packages/gmail/snippets.json @@ -0,0 +1,54 @@ +{ + "CREATE": { + "Add Label to Email": { + "description": "Add a label to an email message.", + "code": "" + }, + "Archive Email": { + "description": "Archive an email message.", + "code": "" + }, + "Create Draft": { + "description": "Create a draft email message.", + "code": "" + }, + "Create Draft Reply": { + "description": "Create a draft reply to an existing email.", + "code": "" + }, + "Create Label": { + "description": "Creates a new label.", + "code": "" + }, + "Delete Email": { + "description": "Sends an email message to the trash.", + "code": "" + }, + "Remove Label From Conversation": { + "description": "Remove a specified label from all emails within a conversation.", + "code": "" + }, + "Remove Label From Email": { + "description": "Remove a label from an email message.", + "code": "" + }, + "Reply to Email": { + "description": "Send a reply to an email message.", + "code": "" + }, + "Send Email": { + "description": "Create and send a new email message.", + "code": "// Send a new email through Gmail.\n// Pass a single message object, or an array to send several in one step.\nsendMessage({\n // Recipient address (or an array of addresses).\n to: 'recipient@example.org',\n // Subject line.\n subject: 'Hello from OpenFn',\n // Message body. Plain text by default; pass html: true for HTML.\n body: `Hi there,\\n\\nThis email was sent from an OpenFn workflow.`,\n // Optional CC / BCC.\n // cc: 'cc@example.org',\n // bcc: 'bcc@example.org',\n // Optional file attachments.\n // attachments: [{ filename: 'report.csv', content: $.csv }],\n});" + } + }, + "SEARCH": { + "Find Email": { + "description": "Finds an email message. Optionally, create an email if none are found.", + "code": "// Find emails matching a Gmail search query.\n// Results land on state.data as an array of message contents.\ngetContentsFromMessages({\n // Standard Gmail search syntax (from:, subject:, after:, has:attachment, ...).\n query: 'from:billing@example.org subject:invoice after:2026/01/01',\n // Which fields to pull back per message.\n contents: ['from', 'date', 'subject', 'body'],\n // Cap the number of messages returned.\n maxResults: 25,\n});" + }, + "Get Attachment by Filename": { + "description": "Retrieves a specific Gmail message attachment by Filename.", + "code": "" + } + } +} diff --git a/packages/googledrive/snippets.json b/packages/googledrive/snippets.json new file mode 100644 index 0000000000..6d15c0d382 --- /dev/null +++ b/packages/googledrive/snippets.json @@ -0,0 +1,86 @@ +{ + "CREATE": { + "Copy File": { + "description": "Create a copy of the specified file.", + "code": "" + }, + "Copy File from Another Service": { + "description": "Copies an existing file from another service to Google Drive.", + "code": "" + }, + "Create File From Text": { + "description": "Create a new file from plain text.", + "code": "// Create a new file from a string of text.\ncreate(\n // 1) File body (text or binary buffer).\n `Report generated on ${new Date().toISOString()}\\n\\n${$.data.body}`,\n // 2) File name (extension determines the default mime type).\n 'report.txt'\n);" + }, + "Create Folder": { + "description": "Create a new, empty folder.", + "code": "// Create an empty folder.\n// Pass `null` for content and the folder mime type via options.\ncreate(null, 'My new folder', {\n mimeType: 'application/vnd.google-apps.folder',\n});" + }, + "Create Shared Drive": { + "description": "Create a new shared drive (Team Drive) in Google Drive.", + "code": "" + }, + "Create Shortcut": { + "description": "Create a shortcut to a file.", + "code": "" + }, + "Delete File": { + "description": "Delete a file in Google Drive (requires file ID).", + "code": "" + }, + "Export File": { + "description": "Export Google Workspace files to different formats (PDF, Word, Excel, etc.).", + "code": "" + }, + "Move File": { + "description": "Move a file from one folder to another.", + "code": "" + }, + "Permanently Delete File": { + "description": "Permanently delete a file from Google Drive. Cannot be undone.", + "code": "" + }, + "Remove File Access": { + "description": "Remove specific user access to a file.", + "code": "" + }, + "Upload File": { + "description": "Uploads a file to the given path.", + "code": "// Upload a file's contents to Drive.\n// `content` can be a string or a Buffer; the file name carries the extension.\ncreate(\n $.data.fileContent,\n $.data.fileName,\n {\n // Optional parent folder id.\n parents: [$.configuration.parentFolderId],\n // Optional mime type override.\n mimeType: 'text/csv',\n }\n);" + }, + "API Request (Beta)": { + "description": "Raw HTTP request with authentication.", + "code": "" + } + }, + "SEARCH": { + "Find a File": { + "description": "Search for a specific file by name.", + "code": "// Search for files by name. `list` returns matching items on state.data.\nlist(\n // 1) Folder id to scope the search to (or null to search the whole Drive).\n $.configuration.parentFolderId,\n // 2) Drive list query options.\n {\n // Drive query syntax: https://developers.google.com/drive/api/guides/search-files\n q: `name = '${$.data.fileName}' and trashed = false`,\n fields: 'files(id,name,mimeType,modifiedTime)',\n }\n);" + }, + "Find a Folder": { + "description": "Search for a specific folder by name.", + "code": "// Search for folders by name.\nlist(null, {\n q: `mimeType = 'application/vnd.google-apps.folder' and name = '${$.data.folderName}' and trashed = false`,\n fields: 'files(id,name)',\n});" + }, + "Find or Create File": { + "description": "Finds or creates a specific file.", + "code": "" + }, + "Find or Create Folder": { + "description": "Finds or creates a specific folder.", + "code": "" + }, + "List File Permissions": { + "description": "List all users who have access to a file.", + "code": "" + }, + "Retrieve File or Folder by ID": { + "description": "Get a file or folder by its ID.", + "code": "// Retrieve metadata for a file or folder by its id.\nget($.data.fileId);" + }, + "Retrieve Files": { + "description": "GET request to the Google Drive API to retrieve a list of files.", + "code": "// List files inside a folder.\nlist(\n $.configuration.parentFolderId,\n {\n fields: 'files(id,name,mimeType,modifiedTime)',\n pageSize: 100,\n }\n);" + } + } +} diff --git a/packages/googlesheets/snippets.json b/packages/googlesheets/snippets.json new file mode 100644 index 0000000000..6367c6e6bc --- /dev/null +++ b/packages/googlesheets/snippets.json @@ -0,0 +1,118 @@ +{ + "CREATE": { + "Change Sheet Properties": { + "description": "Update Google Sheets properties like frozen rows/columns, sheet position, and visibility settings.", + "code": "" + }, + "Clear Spreadsheet Row(s)": { + "description": "Clears the contents of the selected row(s) while keeping the row(s) intact in the spreadsheet.", + "code": "// Clear cell contents in a row (or rows) by writing empty strings.\n// The row(s) themselves stay in place; only the values are wiped.\nbatchUpdateValues({\n spreadsheetId: '1O-a4_RgPF_p8W3I6b5M9wobA3-CBW8hLClZfUik5sos',\n valueInputOption: 'USER_ENTERED',\n data: [\n {\n // A1 range covering the row(s) to clear.\n range: 'Sheet1!A5:Z5',\n // One inner array per row, sized to the range.\n values: [Array(26).fill('')],\n },\n ],\n});" + }, + "Copy Range": { + "description": "Copy data from one range to another within a Google Sheets spreadsheet, with options for what to paste (values, formatting, etc.).", + "code": "" + }, + "Copy Worksheet": { + "description": "Creates a new worksheet by copying an existing worksheet.", + "code": "" + }, + "Create Conditional Formatting Rule": { + "description": "Apply conditional formatting to cells in a Google Sheets spreadsheet based on their values.", + "code": "" + }, + "Create Multiple Spreadsheet Rows": { + "description": "Create one or more new rows in a specific spreadsheet (with line item support).", + "code": "// Append many rows in one call.\n// Each inner array is one row; cells must line up with your columns.\nappendValues({\n spreadsheetId: '1O-a4_RgPF_p8W3I6b5M9wobA3-CBW8hLClZfUik5sos',\n range: 'Sheet1!A1:D1',\n values: $.data.records.map(r => [r.name, r.email, r.amount, r.date]),\n});" + }, + "Create Spreadsheet": { + "description": "Creates a new spreadsheet. Choose from a blank spreadsheet, a copy of an existing one, or one with headers.", + "code": "" + }, + "Create Spreadsheet Column": { + "description": "Create a new column in a specific spreadsheet.", + "code": "" + }, + "Create Spreadsheet Row": { + "description": "Create a new row in a specific spreadsheet.", + "code": "// Append a single row to the bottom of a sheet.\nappendValues({\n // Spreadsheet ID — the long string from the sheet's URL.\n spreadsheetId: '1O-a4_RgPF_p8W3I6b5M9wobA3-CBW8hLClZfUik5sos',\n // Where to append. Sheet name + column range.\n range: 'Sheet1!A1:D1',\n // Outer array = rows, inner arrays = cells in column order.\n values: [\n [$.data.name, $.data.email, $.data.amount, $.data.date],\n ],\n});" + }, + "Create Spreadsheet Row at Top": { + "description": "Creates a new spreadsheet row at the top of a spreadsheet (after the header row).", + "code": "" + }, + "Create Worksheet": { + "description": "Creates a new worksheet in a Google Sheet.", + "code": "" + }, + "Delete Sheet": { + "description": "Permanently delete a worksheet from a Google Sheets spreadsheet. Warning: This action cannot be undone.", + "code": "" + }, + "Delete Spreadsheet Row(s)": { + "description": "Deletes the selected row(s) from the spreadsheet. This action removes the row(s) and all associated data.", + "code": "" + }, + "Format Cell Range": { + "description": "Apply date, number, or style formatting (colors, bold, italic, strikethrough) to a range of cells in a Google Sheets spreadsheet.", + "code": "" + }, + "Format Spreadsheet Row": { + "description": "Format a row in a specific spreadsheet.", + "code": "" + }, + "Rename Sheet": { + "description": "Rename a worksheet in a Google Sheets spreadsheet.", + "code": "" + }, + "Set Data Validation": { + "description": "Set data validation rules on a range of cells in Google Sheets to control what data can be entered.", + "code": "" + }, + "Sort Range": { + "description": "Sort data within a specified range in Google Sheets by a chosen column in ascending or descending order.", + "code": "" + }, + "Update Spreadsheet Row": { + "description": "Update a row in a specific spreadsheet with optional formatting.", + "code": "// Overwrite the values of a single row.\nbatchUpdateValues({\n spreadsheetId: '1O-a4_RgPF_p8W3I6b5M9wobA3-CBW8hLClZfUik5sos',\n // Parse cell input like a user typed it (formulas, dates, etc.).\n valueInputOption: 'USER_ENTERED',\n data: [\n {\n range: 'Sheet1!A5:D5',\n values: [[$.data.name, $.data.email, $.data.amount, $.data.date]],\n },\n ],\n});" + }, + "Update Spreadsheet Row(s)": { + "description": "Update one or more rows in a specific spreadsheet (with line item support).", + "code": "// Overwrite multiple ranges in one batch.\nbatchUpdateValues({\n spreadsheetId: '1O-a4_RgPF_p8W3I6b5M9wobA3-CBW8hLClZfUik5sos',\n valueInputOption: 'USER_ENTERED',\n data: $.data.updates.map(u => ({\n range: u.range,\n values: [u.row],\n })),\n});" + }, + "API Request (Beta)": { + "description": "This is an advanced action which makes a raw HTTP request that includes this integration's authentication.", + "code": "" + } + }, + "SEARCH": { + "Find Worksheet": { + "description": "Finds a worksheet by title. Optionally, create a worksheet if none are found.", + "code": "" + }, + "Get Data Range": { + "description": "Get data from a specific range in a Google Spreadsheet using A1 notation (e.g., \"A1:D10\", \"B2:E5\").", + "code": "// Read values from an A1 range. Result is on state.data as a 2d array.\ngetValues(\n // Spreadsheet ID.\n '1O-a4_RgPF_p8W3I6b5M9wobA3-CBW8hLClZfUik5sos',\n // A1 range — sheet name + range.\n 'Sheet1!A1:D100'\n);" + }, + "Get Many Spreadsheet Rows (Advanced)": { + "description": "Return up to 1,500 rows as a single JSON value or as line items.", + "code": "// Pull a wide range and return all rows.\ngetValues(\n '1O-a4_RgPF_p8W3I6b5M9wobA3-CBW8hLClZfUik5sos',\n // Open-ended range — fetches every populated row in the column span.\n 'Sheet1!A2:Z'\n);" + }, + "Get Row by ID": { + "description": "Get a specific spreadsheet row by its row number (ID). Row 1 is typically the header row.", + "code": "// Fetch a single row by its row number (1-based).\nconst rowId = $.data.rowId;\ngetValues(\n '1O-a4_RgPF_p8W3I6b5M9wobA3-CBW8hLClZfUik5sos',\n // Build an A1 range that spans only that row.\n `Sheet1!A${rowId}:Z${rowId}`\n);" + }, + "Get Spreadsheet by ID": { + "description": "Get a specific Google Spreadsheet by its ID. Returns the raw spreadsheet data from the Google Sheets API.", + "code": "" + }, + "Lookup Spreadsheet Row": { + "description": "Find a specific spreadsheet row based on a column and value. If found, it returns the entire row. Optionally, create a spreadsheet row if none are found.", + "code": "// Read a range, then filter in the callback to find the matching row.\ngetValues(\n '1O-a4_RgPF_p8W3I6b5M9wobA3-CBW8hLClZfUik5sos',\n 'Sheet1!A1:D100',\n // Callback receives state with rows on state.data.values.\n state => {\n const [header, ...rows] = state.data.values || [];\n // Match on the second column (index 1).\n state.match = rows.find(r => r[1] === $.data.email);\n return state;\n }\n);" + }, + "Lookup Spreadsheet Rows (Advanced)": { + "description": "Find up to 500 rows based on a column and value as line items.", + "code": "// Read a range, then filter in the callback for all matches.\ngetValues(\n '1O-a4_RgPF_p8W3I6b5M9wobA3-CBW8hLClZfUik5sos',\n 'Sheet1!A1:D500',\n state => {\n const [header, ...rows] = state.data.values || [];\n state.matches = rows.filter(r => r[1] === $.data.email);\n return state;\n }\n);" + } + } +} diff --git a/packages/http/snippets.json b/packages/http/snippets.json new file mode 100644 index 0000000000..24cae8e75c --- /dev/null +++ b/packages/http/snippets.json @@ -0,0 +1,22 @@ +{ + "CREATE": { + "Custom Request": { + "description": "Fire off a custom request by providing raw details.", + "code": "// Make an arbitrary HTTP request.\n// state.data is set to the parsed response body.\nrequest('POST', 'https://api.example.org/v1/things', {\n // JSON body (sent as application/json by default).\n body: { name: $.data.name, amount: $.data.amount },\n // Extra headers.\n headers: { 'X-Trace-Id': $.run.id },\n // Querystring parameters.\n query: { ref: $.data.ref },\n});" + }, + "PUT Request": { + "description": "Fire off a single PUT request as a form or JSON.", + "code": "// Send a PUT request with a JSON body.\nput('https://api.example.org/v1/things/123', $.data.payload, {\n headers: { 'X-Trace-Id': $.run.id },\n});" + }, + "POST Request": { + "description": "Fire off a single POST request as a form or JSON.", + "code": "// Send a POST request with a JSON body.\npost('https://api.example.org/v1/things', $.data.payload, {\n headers: { 'X-Trace-Id': $.run.id },\n});" + } + }, + "SEARCH": { + "GET Request": { + "description": "Fire off a single GET request with optional querystrings.", + "code": "// Send a GET request.\nget('https://api.example.org/v1/things', {\n query: { limit: 10, status: 'active' },\n});" + } + } +} diff --git a/packages/intuit/snippets.json b/packages/intuit/snippets.json new file mode 100644 index 0000000000..8a8e6f5878 --- /dev/null +++ b/packages/intuit/snippets.json @@ -0,0 +1,54 @@ +{ + "CREATE": { + "Create Customer": { + "description": "Creates a new customer.", + "code": "// Create a customer via the QuickBooks REST API.\n// The intuit adaptor exposes a thin HTTP wrapper (http.post / http.get).\nhttp.post(`/v3/company/${$.configuration.realmId}/customer`, {\n DisplayName: $.data.name,\n PrimaryEmailAddr: { Address: $.data.email },\n PrimaryPhone: { FreeFormNumber: $.data.phone },\n});" + }, + "Create Estimate": { + "description": "Creates a new estimate.", + "code": "// Create an estimate.\nhttp.post(`/v3/company/${$.configuration.realmId}/estimate`, {\n CustomerRef: { value: $.data.customerId },\n Line: $.data.lineItems,\n});" + }, + "Create Expense": { + "description": "Creates a new expense.", + "code": "// Create an expense (Purchase with PaymentType=Cash/Check/CreditCard).\nhttp.post(`/v3/company/${$.configuration.realmId}/purchase`, {\n PaymentType: 'Cash',\n AccountRef: { value: $.data.accountId },\n Line: $.data.lineItems,\n});" + }, + "Create Invoice": { + "description": "Creates a new invoice.", + "code": "// Create an invoice.\nhttp.post(`/v3/company/${$.configuration.realmId}/invoice`, {\n CustomerRef: { value: $.data.customerId },\n Line: $.data.lineItems,\n});" + }, + "Create Payment": { + "description": "Records a new payment.", + "code": "// Record a payment against an invoice.\nhttp.post(`/v3/company/${$.configuration.realmId}/payment`, {\n CustomerRef: { value: $.data.customerId },\n TotalAmt: $.data.amount,\n Line: [\n {\n Amount: $.data.amount,\n LinkedTxn: [{ TxnId: $.data.invoiceId, TxnType: 'Invoice' }],\n },\n ],\n});" + }, + "Create Sales Receipt": { + "description": "Creates a new sales receipt.", + "code": "// Create a sales receipt.\nhttp.post(`/v3/company/${$.configuration.realmId}/salesreceipt`, {\n CustomerRef: { value: $.data.customerId },\n Line: $.data.lineItems,\n});" + }, + "Send Invoice": { + "description": "Sends an invoice to a customer.", + "code": "// Send an existing invoice by email.\n// The sendTo querystring overrides the customer's email on file.\nhttp.post(\n `/v3/company/${$.configuration.realmId}/invoice/${$.data.invoiceId}/send?sendTo=${encodeURIComponent($.data.email)}`,\n // QuickBooks requires an empty JSON body on this endpoint.\n {}\n);" + }, + "Update Customer": { + "description": "Updates an existing customer.", + "code": "// Sparse update on a customer (Id + SyncToken required).\nhttp.post(`/v3/company/${$.configuration.realmId}/customer`, {\n Id: $.data.customerId,\n SyncToken: $.data.syncToken,\n sparse: true,\n PrimaryEmailAddr: { Address: $.data.email },\n});" + }, + "API Request (Beta)": { + "description": "Raw HTTP request with authentication.", + "code": "// Make an arbitrary GET or POST against QuickBooks.\nhttp.get(`/v3/company/${$.configuration.realmId}/companyinfo/${$.configuration.realmId}`);" + } + }, + "SEARCH": { + "Find Customer": { + "description": "Find a customer by name or email.", + "code": "// Look up a customer with a QuickBooks query.\n// Quote string literals with single quotes.\nhttp.get(\n `/v3/company/${$.configuration.realmId}/query` +\n `?query=` + encodeURIComponent(\n `select * from Customer where PrimaryEmailAddr = '${$.data.email}'`\n )\n);" + }, + "Find Invoice": { + "description": "Find an invoice.", + "code": "// Look up an invoice by DocNumber.\nhttp.get(\n `/v3/company/${$.configuration.realmId}/query` +\n `?query=` + encodeURIComponent(\n `select * from Invoice where DocNumber = '${$.data.docNumber}'`\n )\n);" + }, + "Find or Create Customer": { + "description": "Find or create a customer.", + "code": "" + } + } +} diff --git a/packages/mailchimp/snippets.json b/packages/mailchimp/snippets.json new file mode 100644 index 0000000000..51260c6555 --- /dev/null +++ b/packages/mailchimp/snippets.json @@ -0,0 +1,82 @@ +{ + "CREATE": { + "Add Note to Subscriber": { + "description": "Adds a new note to an existing subscriber.", + "code": "" + }, + "Add/Update Subscriber": { + "description": "Add a new subscriber or update an existing one.", + "code": "// Add or update one or more subscribers on a list.\nupsertMembers({\n // The Mailchimp audience (list) id.\n listId: $.configuration.listId,\n // Array of users to upsert.\n users: [\n {\n email: $.data.email,\n status: 'subscribed',\n mergeFields: { FNAME: $.data.firstName, LNAME: $.data.lastName },\n },\n ],\n});" + }, + "Archive Subscriber": { + "description": "Archives an existing subscriber.", + "code": "// Archive a single subscriber by email.\narchiveMember({\n listId: $.configuration.listId,\n email: $.data.email,\n});" + }, + "Create Audience": { + "description": "Creates a new audience in your MailChimp account.", + "code": "" + }, + "Create Campaign": { + "description": "Creates a campaign draft.", + "code": "" + }, + "Create Custom Event": { + "description": "Creates a custom event for an existing subscriber.", + "code": "" + }, + "Create Tag": { + "description": "Creates a new tag.", + "code": "" + }, + "Permanently Delete Member": { + "description": "Deletes all personally identifiable information related to a member.", + "code": "// Permanently delete a member (cannot be undone; member can't be re-subscribed).\ndeleteMember({\n listId: $.configuration.listId,\n email: $.data.email,\n});" + }, + "Remove Subscriber from Tag": { + "description": "Removes a subscriber from a tag within an audience.", + "code": "// Remove a tag from a subscriber by marking the tag as inactive.\nupdateMemberTags({\n listId: $.configuration.listId,\n email: $.data.email,\n tags: [\n { name: $.data.tagName, status: 'inactive' },\n ],\n});" + }, + "Unsubscribe or Delete Contact": { + "description": "Unsubscribe or delete a contact by email address.", + "code": "// Unsubscribe a member (set status to 'unsubscribed').\nupdateMember({\n listId: $.configuration.listId,\n email: $.data.email,\n status: 'unsubscribed',\n});" + }, + "API Request (Beta)": { + "description": "Raw HTTP request with authentication.", + "code": "// Make an arbitrary request to the Mailchimp API.\n// Path is relative to https://{dc}.api.mailchimp.com/3.0\nrequest('GET', '/ping');" + } + }, + "SEARCH": { + "Campaign Report": { + "description": "Get report details for a specific sent campaign.", + "code": "// Fetch the summary report for a campaign.\nget(`/reports/${$.data.campaignId}`);" + }, + "Click Report": { + "description": "Get report details for specific link clicks.", + "code": "// Fetch click-detail report for a campaign.\nget(`/reports/${$.data.campaignId}/click-details`);" + }, + "Find a Campaign": { + "description": "Finds an existing campaign.", + "code": "// Fetch a single campaign by id.\nget(`/campaigns/${$.data.campaignId}`);" + }, + "Find a Subscriber": { + "description": "Searches for a subscriber on your MailChimp audience.", + "code": "// Search every audience for a subscriber matching this email.\nget('/search-members', { query: $.data.email });" + }, + "Find Customer": { + "description": "Finds a customer by email address.", + "code": "// Fetch an e-commerce customer by id on a store.\nget(`/ecommerce/stores/${$.data.storeId}/customers/${$.data.customerId}`);" + }, + "Find or Create Campaign": { + "description": "Finds an existing campaign.", + "code": "" + }, + "Find or Create Subscriber": { + "description": "Searches for a subscriber on your MailChimp audience.", + "code": "" + }, + "Find Tag": { + "description": "Find a tag.", + "code": "// Look up segments (tags) for a list.\nget(`/lists/${$.configuration.listId}/segments`, {\n type: 'static',\n});" + } + } +} diff --git a/packages/mailgun/snippets.json b/packages/mailgun/snippets.json new file mode 100644 index 0000000000..c5dfd4134f --- /dev/null +++ b/packages/mailgun/snippets.json @@ -0,0 +1,28 @@ +{ + "CREATE": { + "Add Mailing List Member": { + "description": "Adds a new member to a mailing list.", + "code": "" + }, + "Bulk Email Validation": { + "description": "Upload a CSV and start a bulk validation job using Mailgun V4 API.", + "code": "" + }, + "Get Bulk Validation Results": { + "description": "Retrieves completed bulk validation job results.", + "code": "" + }, + "Send Email": { + "description": "Sends an email using your Mailgun account.", + "code": "// Send an email via Mailgun.\nsend({\n // Sender address. Use a domain you've verified in Mailgun.\n from: `OpenFn `,\n // Recipient (string, or array for multiple).\n to: $.data.recipient,\n subject: $.data.subject,\n // Plain-text and / or HTML bodies.\n text: $.data.body,\n // html: `

${$.data.body}

`,\n});" + }, + "Validate Email": { + "description": "Validates an email address and returns deliverability results.", + "code": "" + }, + "API Request (Beta)": { + "description": "Raw HTTP request with authentication.", + "code": "" + } + } +} diff --git a/packages/mongodb/snippets.json b/packages/mongodb/snippets.json new file mode 100644 index 0000000000..2a8e648624 --- /dev/null +++ b/packages/mongodb/snippets.json @@ -0,0 +1,8 @@ +{ + "CREATE": { + "Insert New Document": { + "description": "Inserts a new document into a MongoDB collection.", + "code": "// Insert one or more documents into a collection.\ninsertDocuments({\n // Database name.\n database: 'my_db',\n // Collection name.\n collection: 'users',\n // One or many documents.\n documents: [\n { email: $.data.email, name: $.data.name },\n ],\n});" + } + } +} diff --git a/packages/mssql/snippets.json b/packages/mssql/snippets.json new file mode 100644 index 0000000000..3b2a952af3 --- /dev/null +++ b/packages/mssql/snippets.json @@ -0,0 +1,26 @@ +{ + "CREATE": { + "New Row": { + "description": "Adds a new row.", + "code": "// Insert a row into a SQL Server table.\ninsert(\n 'users',\n { name: 'Elodie', email: 'elodie@example.org', age: 31 },\n { writeSql: true }\n);" + }, + "Update Row": { + "description": "Updates an existing row.", + "code": "// Update a row using a parameterised query.\n// In mssql, named parameters use @-prefixed placeholders.\nsql({\n query: 'UPDATE users SET email = @email WHERE id = @id;',\n params: { email: $.data.email, id: $.data.id },\n writeSql: true,\n});" + } + }, + "SEARCH": { + "Find Row": { + "description": "Finds a row in a table via a lookup column.", + "code": "// Fetch a single value from a row matched by an equality filter.\nfindValue({\n uuid: 'id',\n relation: 'users',\n where: { email: $.data.email },\n});" + }, + "Find Row via Custom Query": { + "description": "Finds a row in a table via a custom query you control.", + "code": "// Run a custom SELECT returning a single row.\nsql({\n query: 'SELECT TOP 1 * FROM users WHERE email = @email;',\n params: { email: $.data.email },\n});" + }, + "Find Rows via Custom Query": { + "description": "Finds multiple rows in a table via a custom query you control.", + "code": "// Run a custom SELECT returning many rows.\nsql({\n query: 'SELECT id, name, email FROM users WHERE created_at > @since ORDER BY id;',\n params: { since: '2026-01-01' },\n});" + } + } +} diff --git a/packages/mysql/snippets.json b/packages/mysql/snippets.json new file mode 100644 index 0000000000..46a18a320e --- /dev/null +++ b/packages/mysql/snippets.json @@ -0,0 +1,22 @@ +{ + "CREATE": { + "New Row": { + "description": "Adds a new row.", + "code": "// Insert a row into a MySQL table.\ninsert(\n 'users',\n { name: 'Elodie', email: 'elodie@example.org', age: 31 }\n);" + }, + "Update Row": { + "description": "Updates an existing row.", + "code": "// Update a row using a parameterised query.\n// MySQL placeholders are positional `?` values.\nsql(\n 'UPDATE users SET email = ?, updated_at = NOW() WHERE id = ?;',\n { values: [$.data.email, $.data.id] }\n);" + } + }, + "SEARCH": { + "Find Row": { + "description": "Finds a row in a table via a lookup column.", + "code": "// Fetch one row by equality filter.\nsql(\n 'SELECT * FROM users WHERE email = ? LIMIT 1;',\n { values: [$.data.email] }\n);" + }, + "Find Row via Custom Query": { + "description": "Finds a row in a table via a custom query you control.", + "code": "// Run a custom SELECT.\nsql(\n 'SELECT id, name, email FROM users WHERE created_at > ? ORDER BY id;',\n { values: ['2026-01-01'] }\n);" + } + } +} diff --git a/packages/nexmo/snippets.json b/packages/nexmo/snippets.json new file mode 100644 index 0000000000..b5f88d37ad --- /dev/null +++ b/packages/nexmo/snippets.json @@ -0,0 +1,12 @@ +{ + "CREATE": { + "Send SMS": { + "description": "Send an SMS message.", + "code": "// Send an SMS via Vonage / Nexmo.\nsendSMS(\n // 1) Sender id (alphanumeric or your Vonage number, E.164).\n $.configuration.fromNumber,\n // 2) Recipient, E.164 format.\n $.data.phone,\n // 3) Message body.\n `Hi ${$.data.name}, your appointment is confirmed.`\n);" + }, + "Make Call": { + "description": "Make a voice call.", + "code": "" + } + } +} diff --git a/packages/odoo/snippets.json b/packages/odoo/snippets.json new file mode 100644 index 0000000000..48feb88f79 --- /dev/null +++ b/packages/odoo/snippets.json @@ -0,0 +1,26 @@ +{ + "CREATE": { + "Create Lead": { + "description": "Creates a lead.", + "code": "// Create a CRM lead in Odoo.\ncreate(\n // Odoo model name.\n 'crm.lead',\n // Field values.\n {\n name: $.data.opportunityName,\n contact_name: $.data.contactName,\n email_from: $.data.email,\n phone: $.data.phone,\n }\n);" + }, + "Create/Update Module Entry": { + "description": "Creates or updates a module entry.", + "code": "// Create (or update) a record in any Odoo model.\n// To create:\ncreate('res.partner', {\n name: $.data.name,\n email: $.data.email,\n});\n\n// To update an existing record:\n// update('res.partner', $.data.partnerId, { email: $.data.email });" + }, + "Relate Module Entry": { + "description": "Relates an entry in this module with an entry in another module.", + "code": "// Set a many2one relation field by writing the related id.\nupdate(\n // Model owning the relation field.\n 'crm.lead',\n // Record id on that model.\n $.data.leadId,\n // Many2one fields take just the related id.\n { partner_id: $.data.partnerId }\n);" + } + }, + "SEARCH": { + "Find Module Entry": { + "description": "Finds an entry in a module.", + "code": "// Search a model with an Odoo domain filter and pull a single record back.\nsearchReadRecord(\n 'res.partner',\n // Odoo domain: array of triples or logical operators.\n [['email', '=', $.data.email]],\n // Fields to return.\n ['id', 'name', 'email']\n);" + }, + "Find Multiple Module Entries": { + "description": "Finds multiple entries in a module (with line item support).", + "code": "// Search a model and return many records.\nsearchReadRecord(\n 'crm.lead',\n // Domain — leads created in the last 30 days.\n [['create_date', '>=', '2026-04-01']],\n ['id', 'name', 'email_from', 'stage_id']\n);" + } + } +} diff --git a/packages/postgresql/snippets.json b/packages/postgresql/snippets.json new file mode 100644 index 0000000000..3a0a4cc4da --- /dev/null +++ b/packages/postgresql/snippets.json @@ -0,0 +1,26 @@ +{ + "CREATE": { + "New Row": { + "description": "Adds a new row.", + "code": "// Insert one row into a table.\n// The new row is returned on state.data.\ninsert(\n // Target table name.\n 'users',\n // The record as a plain object (column => value).\n { name: 'Elodie', email: 'elodie@example.org', age: 31 },\n // Optional settings.\n {\n // Print the generated SQL to the run log (handy while developing).\n writeSql: true,\n // Treat these literal strings in the payload as SQL NULL.\n setNull: [\"''\", \"'undefined'\"],\n }\n);" + }, + "Update Row": { + "description": "Updates an existing row.", + "code": "// Update an existing row using a parameterised SQL statement.\n// $1, $2... are bound from the `values` array (safe against SQL injection).\nsql(\n 'UPDATE users SET email = $1, updated_at = NOW() WHERE id = $2;',\n {\n values: [$.data.email, $.data.id],\n writeSql: true,\n }\n);" + } + }, + "SEARCH": { + "Find Row": { + "description": "Finds a row in a table via a lookup column.", + "code": "// Fetch a single row's value from a relation.\n// Result is written to state.data.\nfindValue({\n // The column to return (or 'id' / uuid column).\n uuid: 'id',\n // The table or view to query.\n relation: 'users',\n // Equality filter (combined with AND).\n where: { email: $.data.email },\n // Optional operator override per column.\n operator: { email: '=' },\n});" + }, + "Find Row via Custom Query": { + "description": "Finds a row in a table via a custom query you control.", + "code": "// Run an arbitrary SELECT. Results are on state.data.rows.\nsql(\n 'SELECT * FROM users WHERE email = $1 LIMIT 1;',\n {\n values: [$.data.email],\n writeSql: true,\n }\n);" + }, + "Find Rows via Custom Query": { + "description": "Finds multiple rows in a table via a custom query you control.", + "code": "// Run an arbitrary SELECT returning many rows.\nsql(\n 'SELECT id, name, email FROM users WHERE created_at > $1 ORDER BY id;',\n {\n values: ['2026-01-01'],\n }\n);" + } + } +} diff --git a/packages/salesforce/snippets.json b/packages/salesforce/snippets.json new file mode 100644 index 0000000000..660e252fe6 --- /dev/null +++ b/packages/salesforce/snippets.json @@ -0,0 +1,66 @@ +{ + "CREATE": { + "Add Contact to Campaign": { + "description": "Adds an existing contact to an existing campaign.", + "code": "// Add an existing Contact to an existing Campaign by inserting a CampaignMember.\ncreate('CampaignMember', {\n CampaignId: $.data.campaignId,\n ContactId: $.data.contactId,\n Status: 'Sent',\n});" + }, + "Add File to Record": { + "description": "Adds an existing file to an existing Record.", + "code": "" + }, + "Create Record": { + "description": "Creates a new record of a specified Salesforce object.", + "code": "// Create a record on any sObject.\ncreate(\n // 1) API name of the sObject.\n 'Account',\n // 2) Field values, or an array of objects for bulk insert.\n {\n Name: $.data.accountName,\n Industry: $.data.industry,\n }\n);" + }, + "Send Email": { + "description": "Sends an email using Salesforce Simple Email Actions.", + "code": "" + }, + "Update Lead": { + "description": "Updates an existing lead.", + "code": "// Update an existing Lead (Id is required in the payload).\nupdate('Lead', {\n Id: $.data.leadId,\n Status: 'Qualified',\n Email: $.data.email,\n});" + }, + "Update Record": { + "description": "Updates an existing record of a specified Salesforce object.", + "code": "// Update any sObject record. Id field is required.\nupdate($.data.sObjectName, {\n Id: $.data.recordId,\n ...$.data.fields,\n});" + }, + "API Request (Beta)": { + "description": "Raw HTTP request with authentication.", + "code": "// Make a raw, authenticated request against the Salesforce REST API.\nsfRequest({\n method: 'GET',\n url: '/services/data/v59.0/limits',\n});" + } + }, + "SEARCH": { + "Execute SOQL Query": { + "description": "Custom SOQL SELECT queries with aggregate function support.", + "code": "// Run a SOQL query.\nquery(\n `SELECT Id, Name, Email FROM Contact WHERE Email = '${$.data.email}' LIMIT 1`\n);" + }, + "Execute SOSL Search": { + "description": "Custom SOSL queries for text-based searches across multiple objects.", + "code": "" + }, + "Find Child Records": { + "description": "Finds Child Records for a given Parent ID.", + "code": "// Find child Contacts for a given Account using SOQL.\nquery(\n `SELECT Id, Name FROM Contact WHERE AccountId = '${$.data.accountId}'`\n);" + }, + "Find Record": { + "description": "Finds a record by up to two fields and values.", + "code": "// Find one record by a couple of fields.\nquery(\n `SELECT Id, Name FROM Account WHERE Name = '${$.data.name}' AND Industry = '${$.data.industry}' LIMIT 1`\n);" + }, + "Find Record (SOQL)": { + "description": "Finds a record using a SOQL WHERE clause.", + "code": "// Find a record using a SOQL WHERE clause you control.\nquery(\n `SELECT Id, Name FROM Account WHERE ${$.data.whereClause} LIMIT 1`\n);" + }, + "Find Records (Line Items)": { + "description": "Finds records by a field and value (with line-item support).", + "code": "// Find many records by a single field/value match.\nquery(\n `SELECT Id, Name, Email FROM Contact WHERE AccountId = '${$.data.accountId}' LIMIT 200`\n);" + }, + "Find Records (SOQL)": { + "description": "Finds one or more records using a SOQL WHERE clause (with line item support).", + "code": "// Find many records using a SOQL WHERE clause you control.\nquery(\n `SELECT Id, Name FROM Account WHERE ${$.data.whereClause} LIMIT 200`\n);" + }, + "Get Notes and Attachments": { + "description": "Gets all notes and attachments for a record.", + "code": "// Pull ContentDocumentLink rows for a record to enumerate attached files.\nquery(\n `SELECT ContentDocumentId, ContentDocument.Title, ContentDocument.FileType ` +\n `FROM ContentDocumentLink WHERE LinkedEntityId = '${$.data.recordId}'`\n);" + } + } +} diff --git a/packages/sftp/snippets.json b/packages/sftp/snippets.json new file mode 100644 index 0000000000..19d4059535 --- /dev/null +++ b/packages/sftp/snippets.json @@ -0,0 +1,14 @@ +{ + "CREATE": { + "Upload File": { + "description": "Uploads a file to the given path.", + "code": "" + } + }, + "SEARCH": { + "Download File": { + "description": "Downloads the file at the given path.", + "code": "" + } + } +} diff --git a/packages/stripe/snippets.json b/packages/stripe/snippets.json new file mode 100644 index 0000000000..51a0b54c5b --- /dev/null +++ b/packages/stripe/snippets.json @@ -0,0 +1,90 @@ +{ + "CREATE": { + "Cancel Subscription": { + "description": "Cancels a subscription.", + "code": "" + }, + "Confirm Payment": { + "description": "Confirms an existing payment, also known as a PaymentIntent.", + "code": "" + }, + "Create Checkout Session": { + "description": "Creates a new Checkout Session.", + "code": "" + }, + "Create Customer": { + "description": "Creates a new customer.", + "code": "" + }, + "Create Invoice": { + "description": "Creates a new invoice.", + "code": "" + }, + "Create Payment": { + "description": "Creates a new payment, also known as a PaymentIntent.", + "code": "" + }, + "Create Payment Link": { + "description": "Creates a payment link.", + "code": "" + }, + "Create Price": { + "description": "Creates a price.", + "code": "" + }, + "Create Product": { + "description": "Creates a new product.", + "code": "" + }, + "Create Subscription": { + "description": "Creates a new subscription.", + "code": "" + }, + "Deactivate Payment Link": { + "description": "Deactivates a payment link.", + "code": "" + }, + "Update Customer": { + "description": "Updates an existing customer.", + "code": "" + }, + "API Request (Beta)": { + "description": "This is an advanced action which makes a raw HTTP request that includes this integration's authentication.", + "code": "" + } + }, + "SEARCH": { + "Find Account Balance": { + "description": "Finds the account balance for your stripe account", + "code": "// Retrieve the current balance for the connected Stripe account.\nget('balance', '');" + }, + "Find Account by ID": { + "description": "Finds a Stripe account by its ID.", + "code": "// Retrieve a connected account by its acct_* ID.\nget('accounts', $.data.accountId);" + }, + "Find Balance Transactions": { + "description": "Finds transactions that have contributed to the Stripe account balance, such as charges, transfers, and more.", + "code": "// List recent balance transactions.\nlist('balance_transactions', {\n // Page size (max 100).\n limit: 25,\n});" + }, + "Find Charge": { + "description": "Finds an existing charge by its Stripe ID.", + "code": "// Fetch a single charge by its ch_* ID.\nget('charges', $.data.chargeId);" + }, + "Find Customer": { + "description": "Finds an existing customer by their Stripe ID or email address.", + "code": "// Look up by customer ID.\nget('customers', $.data.customerId);\n\n// Or — find by email by listing with a filter.\n// list('customers', { email: $.data.email, limit: 1 });" + }, + "Find Invoice": { + "description": "Finds an existing invoice by its Stripe ID.", + "code": "// Fetch a single invoice by its in_* ID.\nget('invoices', $.data.invoiceId);" + }, + "Find Payment": { + "description": "Finds an existing payment intent by its Stripe ID.", + "code": "// Fetch a single payment intent by its pi_* ID.\nget('payment_intents', $.data.paymentIntentId);" + }, + "Find Subscription": { + "description": "Finds an existing subscription.", + "code": "// Look up by subscription ID.\nget('subscriptions', $.data.subscriptionId);\n\n// Or — list every subscription for a given customer.\n// list('subscriptions', { customer: $.data.customerId, status: 'active' });" + } + } +} diff --git a/packages/twilio/snippets.json b/packages/twilio/snippets.json new file mode 100644 index 0000000000..3c713842d9 --- /dev/null +++ b/packages/twilio/snippets.json @@ -0,0 +1,20 @@ +{ + "CREATE": { + "Call Phone": { + "description": "Call a number or numbers and say a message.", + "code": "" + }, + "Send SMS": { + "description": "Send a SMS to a number or numbers.", + "code": "// Send an SMS via Twilio.\n// state.references is populated with Twilio's API response.\nsendSMS({\n // Message body (max 1600 chars, billed per 160-char segment).\n body: `Hi ${$.data.name}, your appointment is confirmed.`,\n // Your Twilio sending number, in E.164 format (e.g. +14155551212).\n from: $.configuration.fromNumber,\n // Recipient, in E.164 format.\n to: $.data.phone,\n});" + }, + "Send WhatsApp Message": { + "description": "Send a WhatsApp message to one or more recipients.", + "code": "" + }, + "API Request (Beta)": { + "description": "This is an advanced action which makes a raw HTTP request that includes this integration's authentication.", + "code": "" + } + } +} diff --git a/packages/whatsapp/snippets.json b/packages/whatsapp/snippets.json new file mode 100644 index 0000000000..350abb6783 --- /dev/null +++ b/packages/whatsapp/snippets.json @@ -0,0 +1,16 @@ +{ + "CREATE": { + "Send Freeform Message": { + "description": "Send a freeform text message (within 24-hour window only).", + "code": "// Send a freeform text message via the WhatsApp Business API.\n// Only allowed within the 24-hour customer-service window.\nrequest('POST', 'messages', {\n messaging_product: 'whatsapp',\n to: $.data.toPhone, // E.164, no '+' (e.g. '254712345678')\n type: 'text',\n text: { body: $.data.body },\n});" + }, + "Send Media Message": { + "description": "Send a media message (document, image, video, or audio) within 24-hour window.", + "code": "// Send a media attachment. `type` is one of image | video | document | audio.\nrequest('POST', 'messages', {\n messaging_product: 'whatsapp',\n to: $.data.toPhone,\n type: 'image',\n image: {\n // Either a public URL...\n link: $.data.imageUrl,\n // ...or `id` referencing a previously uploaded media id.\n caption: $.data.caption,\n },\n});" + }, + "Send Template Message": { + "description": "Sends an approved template message.", + "code": "// Send an approved WhatsApp template message.\nrequest('POST', 'messages', {\n messaging_product: 'whatsapp',\n to: $.data.toPhone,\n type: 'template',\n template: {\n name: 'hello_world',\n language: { code: 'en_US' },\n // Template body variables, if your template uses {{1}}, {{2}}, ...\n // components: [{\n // type: 'body',\n // parameters: [{ type: 'text', text: $.data.firstName }],\n // }],\n },\n});" + } + } +} diff --git a/packages/zoho/snippets.json b/packages/zoho/snippets.json new file mode 100644 index 0000000000..96462f48a1 --- /dev/null +++ b/packages/zoho/snippets.json @@ -0,0 +1,34 @@ +{ + "CREATE": { + "Create/Update Module Entry": { + "description": "Creates or updates an entry in a specified module.", + "code": "" + }, + "Relate Module Entry": { + "description": "Relates an entry in this module with an entry in another module.", + "code": "" + }, + "Update Module Entry": { + "description": "Updates an existing module entry.", + "code": "" + }, + "API Request (Beta)": { + "description": "Raw HTTP request with authentication.", + "code": "" + } + }, + "SEARCH": { + "Find Module Entry": { + "description": "Finds an entry in a module.", + "code": "" + }, + "Find Multiple Module Entries": { + "description": "Finds multiple entries in a module (with line item support).", + "code": "" + }, + "Find or Create Module Entry": { + "description": "Finds or creates an entry in a module.", + "code": "" + } + } +}