Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/crazywoola/dify-extension

A template code for dify extension written in node.js
https://github.com/crazywoola/dify-extension

Last synced: 7 days ago
JSON representation

A template code for dify extension written in node.js

Awesome Lists containing this project

README

        

# Dify NodeJs Extension Template

## Quick Start

1. Clone this repository
2. Edit `expectedApiKey` in `index.js` to match your API key
3. Run `npm install`
4. Run `npm run start`

## Example payload

### Point: ping

```json
{
"point": "ping"
}
```

```bash
curl --location 'http://localhost:3000/api/dify/receive' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer 123456' \
--data '{
"point": "ping"
}'
```

### Point: app.external_data_tool.query
```json
{
"point": "app.external_data_tool.query",
"params": {
"app_id": "61248ab4-1125-45be-ae32-0ce91334d021",
"tool_variable": "menu",
"inputs": {
"choice": "foods"
},
"query": "Give me something to eat?"
}
}
```

```bash
curl --location 'http://localhost:3000/api/dify/receive' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer 123456' \
--data '{
"point": "app.external_data_tool.query",
"params": {
"app_id": "61248ab4-1125-45be-ae32-0ce91334d021",
"tool_variable": "menu",
"inputs": {
"choice": "foods"
},
"query": "Give me something to eat?"
}
}'
```