Generate integrations using AI¶ Did you know that the WSO2 Integrator: MI component of WSO2 Integrator includes an AI-powered assistant to help you effortlessly generate integration flows? In this guide, you'll use the WSO2 Integrator Copilot to generate an API that retrieves weather information for a specified city and emails it to a designated recipient. Check out this video on YouTube to see it in action. Let's get started!¶ Prerequisites¶ You need Visual Studio Code (VS Code) with the WSO2 Integrator: MI for VS Code extension installed. Info See the Install WSO2 Integrator: MI for VS Code documentation to learn how to install WSO2 Integrator: MI for VS Code. Step 1: Create an integration project¶ The Integration project will contain all the required artifacts for the integration solution. Launch VS Code with the WSO2 Integrator: MI extension installed. Click on the WSO2 Integrator: MI icon on the Activity Bar of the VS Code editor. Click Create New Project on Design View. Next, the Project Creation Form will be opened. In the Project Creation Form, enter AICodeDemo as the Project Name. Provide a location under the Project Directory. Click Create. You will now see the project listed in the Project Explorer. Step 2: Open the Copilot panel and sign in¶ Click the Copilot icon in the top-right corner of VS Code. Sign in with one of the three supported methods — WSO2 Account (default, free with usage quota), Anthropic API key, or AWS Bedrock. For this tutorial, signing in with your WSO2 Account is the simplest option. Info For details on the three sign-in options, see Sign in. Step 3: Describe the integration to the Copilot¶ The Copilot opens a new chat session in Edit mode (the default). In Edit mode the Copilot acts as an agent — it reads your project, adds the connectors it needs, writes the artifacts, validates them against the language server, and captures everything on a Checkpoint card you can review or roll back. Make sure the mode pill in the input bar is set to Edit. Attach the two OpenAPI specifications that describe the geolocation and weather endpoints by clicking the Attach button. Use GeoLocationOAS.yaml and OpenWeatherOAS.yaml. Describe the integration in a single message. For example: Example PromptCreate a REST API called WeatherEmailService at context /weatherEmail with a GET /getWeather resource that accepts city and email query parameters. Use the attached OpenAPI specs to call the OpenWeather geolocation endpoint to get coordinates for the city, then call the current-weather endpoint using those coordinates, and finally email the weather details to the email address in the request. Use the HTTP and Email connectors. Press Enter to send the message. You don't click a "Generate" button — the Copilot runs the whole task autonomously. As it works, the chat panel streams the agent loop in real time: A todo list appears at the top of the response showing what the Copilot has planned (for example, add HTTP connector, add Email connector, create API, create connections, validate). Items tick off as they complete. Tool call indicators such as Adding HTTP connector, Writing WeatherEmailService.xml, and Validating XML show each step. If validation fails, the Copilot reads the error and self-corrects before continuing. The Copilot may pause to ask a clarifying question — for example, which email subject to use — and resumes after your reply. When the agent finishes, a Checkpoint card lists every file it created or changed. The artifacts are already in your project — open the Design View to confirm the API looks right. If something looks off, you have two options without leaving the chat: Click Undo on the Checkpoint card to roll back every file the Copilot changed in that turn, then rephrase your prompt. Send a follow-up message — for example, "Include the city name in the email subject" — and the Copilot will edit the files in place and produce a new checkpoint. When you're happy with the result, click Accept on the Checkpoint card. Note Your generated flow may differ slightly from what's shown here — AI-generated designs can vary. For example, the Copilot may place the mediation logic in a separate sequence instead of inline. The generated API resembles the structure below: WeatherEmailService API sourceSource View <api xmlns="http://ws.apache.org/ns/synapse" name="WeatherEmailService" context="/weatherEmail"> <resource methods="GET" uri-template="/getWeather?city={city}&email={email}"> <inSequence> <variable name="API_KEY" type="STRING" value="REPLACE_WITH_YOUR_KEY"/> <http.get configKey="OpenWeather"> <relativePath>/geo/1.0/direct?q=${params.queryParams.city}&limit=1&appid=${vars.API_KEY}</relativePath> <headers>[]</headers> <forceScAccepted>false</forceScAccepted> <disableChunking>false</disableChunking> <forceHttp10>false</forceHttp10> <noKeepAlive>false</noKeepAlive> <responseVariable>http_get_1</responseVariable> <overwriteBody>true</overwriteBody> </http.get> <http.get configKey="OpenWeather"> <relativePath>/data/2.5/weather?lat=${payload[0].lat}&lon=${payload[0].lon}&appid=${vars.API_KEY}</relativePath> <headers>[]</headers> <forceScAccepted>false</forceScAccepted> <disableChunking>false</disableChunking> <forceHttp10>false</forceHttp10> <noKeepAlive>false</noKeepAlive> <responseVariable>http_get_2</responseVariable> <overwriteBody>true</overwriteBody> </http.get> <email.send configKey="EMAIL_CONN"> <from>[email protected]</from> <personalName></personalName> <to>{${params.queryParams.email}}</to> <cc></cc> <bcc></bcc> <replyTo></replyTo> <subject>Weather Update</subject> <content>{${payload}}</content> <contentType>text/html</contentType> <encoding>UTF-8</encoding> <attachments></attachments> <inlineImages>[]</inlineImages> <contentTransferEncoding>Base64</contentTransferEncoding> </email.send> <respond/> </inSequence> </resource> </api> Email ConnectionDesign ViewSource View <?xml version="1.0" encoding="UTF-8"?> <localEntry key="EMAIL_CONN" xmlns="http://ws.apache.org/ns/synapse"> <email.init> <connectionType>SMTPS</connectionType> <host>smtp.gmail.com</host> <port>465</port> <username>REPLACE</username> <password>REPLACE</password> <name>EMAIL_CONN</name> </email.init> </localEntry> HTTP ConnectionDesign ViewSource View <?xml version="1.0" encoding="UTF-8"?> <localEntry key="OpenWeather" xmlns="http://ws.apache.org/ns/synapse"> <http.init> <connectionType>HTTPS</connectionType> <baseUrl>https://api.openweathermap.org/</baseUrl> <authType>None</authType> <timeoutAction>Never</timeoutAction> <retryCount>0</retryCount> <retryDelay>0</retryDelay> <suspendInitialDuration>-1</suspendInitialDuration> <suspendProgressionFactor>1</suspendProgressionFactor> <name>OpenWeather</name> </http.init> </localEntry> Note Before running the API, update the generated configurations with real credentials: Update the email connection with the credentials of the sender's email account. Update the API_KEY variable with your OpenWeather API key. You can ask the Copilot to open a specific file for you — for example, "Open the Email connection so I can update the credentials." Step 4: Build and run with the Copilot¶ The Copilot can build the project and start the MI runtime for you — no need to leave the chat panel. Send a follow-up message: Build the project and start the server. The agent runs the Maven build, deploys the resulting .car, and starts the MI runtime. You'll see tool call indicators for each step (Running build, Starting MI server) and a link to the Runtime Services panel in the chat when the server is up. Prefer the button?If you'd rather build manually, click the Build and Run button at the top of the editor. Once the server is running, Runtime Services opens. From that panel: Select your API and click Try It. Click Try it Out to open the parameter form. Provide the required query parameters and click Execute. Check the response and confirm that the weather details for the specified city were emailed to the address in the request. That's the agent loop in action — one prompt, the Copilot plans the work, adds the right connectors, writes and validates the artifacts, deploys, and starts the server. From here you can keep going: ask for new resources, request retries with backoff, switch to Plan mode for a reviewable change list, or explore Modes and Features to see what else the Copilot can do.