How to build my first module With SDK and Webhooks
In this article, we will describe how to build your first module for FinanceGPT so you can run your own code against the chat.
As an example, we are going to deploy the most simple app from this repository the demo app: https://github.com/Unique-AG/sdk-deploy-template
Table of Contents:
Ensure a reachable Webhook endpoint (not needed in local dev setup)
To do that we need to create a connection between Unique FinanceGPT and your development environment. For this we use ngrok but you can also use any other way to get a webhook redirected to your development machine. E.g. Azure functions or other mechanisms. It is important that the data can connect from your FinanceGPT environment to your local machine somehow.
Here is an example with ngrok: this forwards the https://cbac-178-197-218-164.ngrok-free.app
to your local 5001 port, where the apps will run.
ngrok http 5001
---
ngrok (Ctrl+C to quit)
K8s Gateway API support available now: https://ngrok.com/r/k8sgb
Session Status online
Account Andreas Hauri (Plan: Free)
Update update available (version 3.9.0, Ctrl-U to update)
Version 3.8.0
Region Europe (eu)
Latency 13ms
Web Interface http://127.0.0.1:4040
Forwarding https://cbac-178-197-218-164.ngrok-free.app -> http://localhost:5001
Connections ttl opn rt1 rt5 p50 p90
543 0 0.00 0.00 2.40 45.26
HTTP Requests
-------------
POST /webhook 200 OK
POST /webhook 200 OK
Setting up the app
Now login to Unique and go to the app registration. This requires admin rights to do so.
Create a new app
Activate the app
Add an endpoint
Make sure you know the URL that your machine is exposing, here it is the ngrok URL but it is webhook because the demo application exposes that.In development
was chosen so the webhook does not expire on too many errors
The unique.chat.external-module.chosen
is the event we are expecting.
Now you can see that it created a key named using_***
which you can expose. This is used for validating on the demo application side that the request is coming from this unique instance and from nowhere else.
Create an API key
Now you create an API KEY
Dont worry my app will be deleted after writing this so you can ignore it.
You will only see this once! Copy the key and store it SECURELY. This has the potential to leak a lot of data to the world.
Remember all the variables for the Python App
Now we need all this info (yes this is the .env variable for your app!):