This example illustrates how to implement a Collab.Land action for Discord interactions.
-
Build
npm run build
-
Test
npm test
-
Run the hello-action server
npm run server
By default, the server will generate an ECDSA key for signature verification between the client (signing the request payload) and the server (verifying the signature of the request).
To run the hello-action server with Collab.Land's public key for signature verification, set the environment variable:
export COLLABLAND_ACTION_PUBLIC_KEY=<public-key>
or
npm run server -- ecdsa npm run server -- ed25519 npm run server -- <public-key>
> @collabland/example-hello-action@0.0.1 server > node dist/server Action signing key: ecdsa:<0x...> Hello action is running at http://[::1]:3000
Copy the signing key (including
ecdsa:
ored25519:
) from the console log. -
Run the hello-action test client
npm run client -- <server-signing-key>
- Use
src/hello-action.ts
as the template - Define action metadata for Discord
- Implement the
handle()
method- Process various Discord interactions
- Generate the first interaction response
- Send/update/delete interaction messages