A Rust application which funnels external webhook event data to an Urbit chat.

Overview

Urbit Webhook Funnel

This is a simple Rust application which funnels external webhook event data to an Urbit chat. This application is intended to be run on a server (easiest setup is via running on the same server that the Urbit ship which will be sending the messages) and will automatically handle all authentication/communicating with the ship itself.

Setup

Ensure that you have the latest version of Rust installed and the libssl-dev package on Ubuntu (aka openssl-devel on Fedora, and potentially slightly different on other distros).

  1. Clone this repository and enter into the folder.

  2. Run the setup script which will compile and prepare everything for you.

sh setup.sh
  1. The Urbit Webhook Funnel application will be compiled, moved into the deployed folder, and two config files will be generated automatically for you.

  2. Edit ship_config.yaml with your Urbit ship's ip/port/+code.

  3. Edit funnel_config.yaml with the port that you wish for the webserver to run on, and the chat owner @p/chat name which you wish to funnel Webhook events to.

  4. Run the application:

./urbit-webhook-funnel
  1. The application will start and the webhook webserver will be on the port specified in the funnel_config.yaml configured to listen to webhook events on the /webhook endpoint. Thus, in your webhook emitting application/platform, the address you provide will look like:
http://ip:port/webhook

Having the ability to choose which port a funnel uses enables for running multiple funnels at the same time on the same server, but each one pointed at a different chat and targeted by a different service. Whichever ports you choose. Please ensure that they are open or else the webhook events won't be able to reach your funnel.

You can visit http://ip:port while your funnel is running, and you will be greeted with a basic text page that provides you with instructive information about your given funnel (can be helpful when running multiple funnels):

Parsers

The Urbit Webhook Funnel attempts to parse any data that is sent to its webhook endpoint using all of the EventParsers that are currently implemented. If any one of them successfully parses the input json, then the event message will be posted using said predefined formatting (aka. make it look pretty). If none of the parsers succeed, then the body of the message is posted in its entirety (usually ugly).

Currently implemented parsers:

  • GitLab

If you have a use case that requires a different parser, implementing one yourself is trivial. All you have to do is create a parser struct and implement the EventParser trait:

/// Trait for Webhook Event Parsers
pub trait EventParser {
    /// Takes in a pushed webhook event json as a string, attempts to
    /// parse said json, and returns a list of Urbit chat `Message`s to be submit
    /// to the chat as properly formatted/processed messages.
    /// Returns `None` if input json is not supported.
    fn parse_json(&self, json_string: &str) -> Option<Vec<Message>>;
}

If you happen to implement an alternative parser for a new use case, please PR to add it to this codebase so that other may also potentially take advantage of the work already done.

Special Thanks

This application was possible thanks to the generous sponsorship of ~mister-todteg.

You might also like...
The official DAW application of the RustyDAW project (name in progress)
The official DAW application of the RustyDAW project (name in progress)

rusty-daw-application The official DAW application of the RustyDAW project (name in progress) Take a look at the design doc. Join our community at the

a port of yaxpeax-dis that runs as a web application

this a rough translation of yaxpeax-dis, the CLI tool, to instead accept architectures and data to disassemble as an HTTP request. the package is then deployed to dis.yaxpeax.net as a compute@edge application.

A web application to configuration Caddy based on MoonZoon.

Cream A web application to configuration Caddy based on MoonZoon. MoonZoon is a Rust Fullstack Framework. Live demo Run on a local machine Check you'v

Starknet application for Ledger Nano S, SP, X
Starknet application for Ledger Nano S, SP, X

Ledger Starkware app Please visit our website at zondax.ch This project contains the Starkware app (https://starkware.co/) for Ledger Nano S and X. Le

Code template for a production Web Application using Axum: The AwesomeApp Blueprint for Professional Web Development.

AwesomeApp rust-web-app More info at: https://awesomeapp.dev/rust-web-app/ rust-web-app YouTube episodes: Episode 01 - Rust Web App - Course to Produc

Axum + JWT authentication Middleware that allows you to start building your application fast

axum_jwt_ware Integration Guide Simple Axum + JWT authentication middleware with implemented Login and refresh token. Goal I aim to simplify the proce

Extremely simple Axum + SolidJS starter for a fullstack web application.

royce Extremely simple Axum + SolidJS starter for a fullstack web application. Deploy immediately with a ready-to-use preconfigured Docker deployment.

A Rust library to extract useful data from HTML documents, suitable for web scraping.

select.rs A library to extract useful data from HTML documents, suitable for web scraping. NOTE: The following example only works in the upcoming rele

Data for this-week-in-rust.org

This Week in Rust Content for this-week-in-rust.org. Made available under CC-BY-SA. All code Copyright 2014 Ember Arlynx, made available under the MIT

Owner
Robert Kornacki
Explorations into the realms of Haskell, Idris, Lean, Coq, Agda, Plutus, mCRL2 and wherever else fate leads me next.
Robert Kornacki
Thalo is an event-sourcing framework for building large scale systems

Thalo Event sourcing framework for building microservices. Overview Thalo is an event-sourcing framework for building large scale systems based on the

null 548 Jan 3, 2023
An occult chat app using Cabal 🧙✨🔮

coven ??✨?? An occult chat app using Cabal Uses the cable.rs implementation of the new Cable protocol. For now is a desktop app, but with the magic of

Mikey 7 Nov 2, 2023
Rust Macro which loads files into the rust binary at compile time during release and loads the file from the fs during dev.

Rust Embed Rust Custom Derive Macro which loads files into the rust binary at compile time during release and loads the file from the fs during dev. Y

Peter 1k Jan 5, 2023
Starlight is a JS engine in Rust which focuses on performance rather than ensuring 100% safety of JS runtime.

starlight Starlight is a JS engine in Rust which focuses on performance rather than ensuring 100% safety of JS runtime. Features Bytecode interpreter

null 453 Dec 31, 2022
Sample serverless application written in Rust

This is a simple serverless application built in Rust. It consists of an API Gateway backed by four Lambda functions and a DynamoDB table for storage.

AWS Samples 165 Jan 8, 2023
Experiments with Rust CRDTs using Tokio web application framework Axum.

crdt-genome Synopsis Experiments with Rust CRDTs using Tokio web application framework Axum. Background Exploring some ideas of Martin Kleppmann, part

dougfort 3 Mar 18, 2022
Reference implementation of a full-stack Rust application

Full-stack Rust with WebAssembly Look Ma, No JavaScript !!! My very first Rust project (implementation of the "Connect 5" game), I used as a learning

Vassil 64 Dec 27, 2022
Build, bundle & ship your Rust WASM application to the web.

Trunk Build, bundle & ship your Rust WASM application to the web. ”Pack your things, we’re going on an adventure!” ~ Ferris Trunk is a WASM web applic

Anthony Dodd 2.2k Jan 7, 2023
Web Application with using Rust(Actix, Diesel and etc)

Santa Service App Used technology stack Web Server with using Rust (Actix, Actix-web, Diesel) Data base (Postgres) Console Application (Tokio) Tasks o

null 3 Jan 8, 2023
Oso is an open source policy engine for authorization that’s embedded in your application

Oso What is Oso? Oso is an open source policy engine for authorization that’s embedded in your application. It provides a declarative policy language

oso 2.8k Jan 4, 2023