Webmethods.io: Implementation
If you follow my Webmethods.io Integration series, you already have an environment, the process blueprint, custom action, and the X/Twitter connector. It's time to use them in a new integration flow.
Let's log back into the Webmethods.io Integration integration environment and open the project we created before. Navigate to our empty project and click on the large blue plus icon in the middle of the project page. On the next page, click the "Create New Workflow" button. If you create integration for something more common than the Ghost blog, you may start with one of the hundreds of recipes with preconfigured workflow components.
If this is your first workflow in this environment, I recommend walking through the tour to familiarize yourself with the workflow design window and controls.
Before we follow the tip and drag the connector, let's define the global workflow parameters we need. We need it for a few reasons:
- It is easier to update global parameters in a single place without updating actions and connectors.
- Workflow parameters offer encrypted protection of your secrets - API keys, passwords, tokens, etc.
Quick steps:
- Click on the gear icon next to the workflow on/off switch, then select the Parameters tab in the dialog window.
- Click on the "Add Parameter" button.
- Set the name field to "GhostHookSecret" and some random string as a value.
- Flip "Set as a Password Field" to encrypt and hide the value.
If you intend to use ChatGPT to generate announcements, add another password field named "GptApiKey." Place your OpenAI API key as a value.
If you followed my previous item on the Ghost Blog event validation, your palette may have a custom Node.js action. The screen capture below demonstrates the creation of the first workflow action (Drag and drop it close to the start button) and then configure the action parameters.
As you may see, the workflow status flashes two warnings, and it's all my fault. We should start editing with the critical step — defining the triggering event.
To do so, Hover the mouse pointer over the start icon and then click the ⛭ icon. Webmthodws.io offers over a hundred events to catch or pool. Luckily, what we need is the very first one — a Webhook.
Select the Webhook Trigger and click the "Next" button.
Now, the wizard suggests you send a test event to the webhook endpoint (bonded to your environment and project) and fetch the headers and body with the "Fetch" button. Although I don't advise you to skip this step, you could paste the headers and body of the request in JSON format. When your test data is set, click next to complete the configuration. Since we should receive events from the outside world, keep the "Private Webhook" off, set "Webhook authentication" to None, and do not change "Autoconnect Return Sync on Webhook" since Ghost does not expect any other response but HTTP-200.
Click "Next" for the summary screen and the actual Webhook URL. Remember to replace the one you used to build a test case. Click "Done" to finish the start trigger configuration and return to the workflow pane. Now, your start action bears the webhook sign.
Open the GhostEventValidator configuration (hover over the action, then select the ⛭ icon) and complete the parameter mapping on the second screen. You should see Project Parameters, Transformations, and the new branch "$request - Webhook" on the left under the "Incoming Data." Expand the $request, then headers, find the "x-signature-ghost," and drag it to the WebHook Signature field on the right. Then, drag the whole "body" part to the "WebHook Request" field. The final mapping should be similar to the screen below.
Click "Next" and move to the test screen. I always test workflow steps to confirm that my action works and to produce the output data for the next activity. Review the test results, and click "Done" when you see the desired outcome.
Use the connectors palette's search field to find "Set Workflow Status Failed." Drag it to the canvas between the GhostEventValidator and "Stop" tasks. The new step will automatically link to your open task.
Hover the cursor over the new task, grab the blue circle on the right side, and pull it to the "End" box.
Let's make the process fail only when the signature is invalid. To do so, we define a connector condition. Watch details on the screengrab below.
This post grows long, so let's name our short but valid workflow and save our progress.
Click on the pencil icon next to the "Untitled Workflow" title. Set the Workflow Name, tags, and description as you see fit.
Click the "Save" button to store all the changes. The designer will display the success confirmation, confirming that all our changes were stored.
In the next post, we will connect our social networks, ChatGPT, and add an error handler.
In case you missed previous publications: