Overview
This webMethods.io Integration workflow example sends automated NPS survey responses generated by the webMethods.io ChatGPT API Connector.
Steps
- As this will be an API, create a webhook trigger.
The body of the post will contain the NPS data as follows:
{
"email": "example@softwareag.com",
"score": "10",
"comments": "very good software. I like it a lot”
}
2.Just to help with debugging I insert a logger after the webhook and log the payload to help during testing.
3.Next to moderate the input add the ChatGPT connector and provide the API Key:
Then select the Create Moderation action:
4.Map the provided comments to the input of the create moderation action:
Press Next, and then test the action.
You see the results/scores returned from the moderation:
5.If all the moderation categories are false, then we’ll generate the AI completion, otherwise we’ll return a standard response. For this, I use the switch control, which I drop into the canvas
6.The default condition takes this to a return data on sync webhook action which just returns a pre-created thank you response, which then links to the end action:
Note: the Access-Control-Allow-Origin with a null value was added so I could test this from an HTML page or a local application.
7.For the other action of the switch, add a ChatGPT connector and link this to the switch action.
8.Position your mouse over the arrow between the 2 nodes and select the settings icon:
9.Now configure the conditions for this transition by adding filters for all of the categories and match for false
10.Ensure the other switch condition is set to the default case by clicking on the settings icon on that arrow and selecting ‘default’
11.Your workflow should now look something like this:
12.Now we need to configure the Completion to generate the AI survey response.
13.Select the Create Completions action and configure it as follows:
a. Set Model to text-davinci-003
b. Set Prompt to: “Create me a response for an NPS survey with a score of “
leaving the cursor in the prompt box and clicking on the score data item from the webhook action.
c. Complete the rest of the prompt as follows: , and where the following comments were provided:
d. Then add the comments to the prompt, so the prompt in total should look something like the following:
Create me a response for an NPS survey with a score of {{$request.body.score}}, and where the following comments were provided: {{$request.body.comments}}
e. Set the temperature to 0.7
(or higher for a more random answer, or lower for a more consistent and deterministic answer).
f. Set max_tokens to 4000
g. Your mapping should then look like this:
14.Press next, then “Test” the action with the test button and you should see a response from the ChatGPT davinci engine:
15.Press Done.
16.Now we’ll moderate the response from ChatGPT for safety by adding another moderation action from ChatGPT and passing the text response from ChatGPT to the moderation API.
17.Press Next and Test this response.
18.Lastly, like the previous moderation, we’ll add a switch with the same checks. If all are false we link to a new return data on sync, otherwise we link to the pre-created response.
19.Lastly, we just need to configure the API response on the return data sync on webhook mapping in the response from ChatGPT:
You can then test the whole integration:
You can also download the workflow archive below and simply import it under your webMethods.io Integration project:
NPS Survey Response (with moderation).zip (91.0 KB)
Note that you will be asked to connect to your OpenAI account and to provide an API key:
You can register for an OpenAI account from here: OpenAI API. After you login, you will need to upgrade your account and create an API key from your account menu.
To learn more about how you can integrate the webMethods.io ChatGPT API Connector with any application, you can watch our demos (we show the steps on how to register for an OpenAI account and create several workflows from scratch):
- Demo: Generative AI (ChatGPT API connector for webMethods.io Integration) Augmenting Human Capabilities
- Demo: Automate and embed ChatGPT in any app with webMethods.io
All connectors available in webMethods.io Integration are listed here Categories - webMethods.io Integration.
If you are new to webMethods.io Integration and want to try it, please refer to this Getting Started with webMethods.io beginner’s guide and sign up here Sign up - Software AG Cloud for a free forever account.
Top comments (0)