Testing the connector
Now that the agent is running - lets test the connector by executing the integration in the model designer.
If you execute the workflow you should get a 'ok' as a reply.

This is because in your agent code, you setup the result to have the value ok
```javascript
return {result:'ok',count:0};
```
So if you see that result, it means the connectivity works!
The next step is receiving inputs.
Lets go back to our agent code inside the processRequest function:
```javascript
async function processRequest(payload) {
return {result:'ok',count:12};
}
```
Lets change this to receive our payload and parse it and extract the query.
Recall in the step where you defined your connector function, you created a JSON payload like
{"query":"select * from foo;","function":"sqlquery"}
So this is the payload we will be receiving inside the processRequest()
function.
Lets parse it and extract the query.
```javascript
async function processRequest(payload) {
let obj = JSON.parse(payload);
if (obj.function == 'sqlquery') {
//TODO: do something
}
return {result:'ok',count:12};
}
```
So we can now extract the sql query.
Now we need to actually integrate sqlite and run the query. Lets do that next.
Last updated