Skip to content

rarimo/collabland-rarimo-poh-action

Repository files navigation

Rarimo Proof of Humanity Collab.Land Action

This repo implements an Collab.Land action that adds /rarimo-verify command to your Discord server and allow members to verify their humanity using the Rarimo Proof of Humanity case.

Table of Contents

Getting Started

Pre-requisites

Environment

Tunnel Forwarding

Configuration

  • Set APP_URL to the URL of your application in the .env file. This URL will be used to redirect users after they verify their humanity. By default, it should be http://localhost:8000 if you didn't change the port (check Starting the server)
  • Set POH_APP_URL to the according url of the Rarimo Proof of Humanity application in the .env file. By default, it should be https://robotornot.mainnet-beta.rarimo.com for the devnet and https://robotornot.rarimo.com for the mainnet.
  • (Optional) In order to verify the webhook requests coming from the Collab.Land bot, please set the SKIP_VERIFICATION variable in your .env file to false.
  • Please, fetch the public key from the [Collab.Land Config], and replace COLLABLAND_ED25519_PUBLIC_KEY_HEX variables in the .env file.
  • (Optional) Set LOG_LEVEL to debug or info in the .env file to specify the log level. By default, it will be debug.

Check the full .env file example config for more details.

Setup

Starting the server

  • Clone the repository to your machine
  • Open the folder in a code editor of your choice
  • Install dependencies:
    yarn install
  • Run Postgres in Docker:
    docker-compose up -d
  • Start the server (The server starts in port 8000 by default):
    yarn dev
  • If the server fails due to the port being occupied, change the server port in the package.json file and in the .env file accordingly:
    // file: package.json
    
    {
      "scripts": {
        "dev": "next dev -p <PORT>"
      }
    }
    # file: .env
    
    APP_URL="http://localhost:<PORT>"
  • To expose your localhost API to public domain, open a new terminal and start NGROK:
    ngrok http <PORT>
  • Copy the .ngrok.io link shown in your terminal:
    # Example:
    
    https://0c49-2601-646-9e00-80-3964-47d-7146-ff13.ngrok.io/

Run with Docker

Build

To build the Docker image, run the following command:

docker build . -t rarimo-poh:latest

Run

Run the following command:

docker-compose up -d

Application will be available at http://localhost:8000, if you didn't change the port in the package.json file and in the .env file, otherwise, you have to change the port accordingly in the docker-compose.yml file in the ports section:

# file: docker-compose.yml

services:
  rarimo-poh:
    image: rarimo-poh:latest
    restart: unless-stopped
    entrypoint: sh -c "node_modules/.bin/next start"
    ports:
      - "<PORT>:8000"

Installing the Collab.Land actions

API Specifications

  • The API exposes two routes per slash command:
    • GET /verify/metadata: To provide the metadata for the /rarimo-verify command
    • POST /verify/interactions: To handle the Discord interactions corresponding to the /rarimo-verify command
  • The slash commands provide example codes for the following Discord interactions:
    • /rarimo-verify: Verify your humanity with Rarimo Proof of Humanity use case and get the verified role in your Discord server.

Contributing

We welcome contributions from the community! To contribute to this project, follow these steps:

  1. Please go through the following "build a custom action" article to understand the deep technical details regarding building on the Collab.Land actions platform.
  2. Fork the repository.
  3. Create a new branch with a descriptive name for your feature or bug fix.
  4. Make your changes and commit them.
  5. Push your changes to your branch on your GitHub fork.
  6. Create a pull request from your branch to the main branch of this repository.

Please ensure your pull request adheres to the following guidelines:

  • Add a clear pull request title;
  • Add a comprehensive pull request description that includes the motivation behind the changes, steps needed to test them, etc;
  • Update the CHANGELOG.md accordingly;
  • Keep the codebase clean and well-documented;
  • Make sure your code is properly tested;
  • Reference any related issues in your pull request;

The maintainers will review your pull request and may request changes or provide feedback before merging. We appreciate your contributions!

Changelog

For the changelog, see CHANGELOG.md.

License

This project is under the MIT License — see the LICENSE file for details.

About

Implementation of the Collab.Land action /verify command for the Discord server which allows members to verify their humanity using the Rarimo Proof of Humanity case.

Topics

Resources

License

Stars

Watchers

Forks