gofbot

command module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 14, 2024 License: MIT Imports: 1 Imported by: 0

README

gofbot

build codecov Go Report Card

A generic forwarding robots for any webhooks.

It was a generic webhook endpoint to call some notifications.

Features

  • Chat with a robot to manage your webhook
  • Match and reply templates through declarative file descriptions
  • Rich template functions help you implement your own reply templates
  • Support multiple chat platforms
  • Support multiple webhook platforms

Non-Features

  • One robot connect to multiple chat platform, your should use multiple robots
  • Message persistence is not supported and messages are not guaranteed to be lost, If you cannot tolerate message loss, you should use it with the event bus

Getting Started

Step1: Write your Message
apiVersion: github.com/bonaysoft/gofbot/v1alpha1
kind: Message
metadata:
  name: gl-push
spec:
  selector:
    matchLabels:
      type: xxCreate

  reply:
    text: |-
      This is a test message.
      name: {{ .name }}
      intro: {{ .intro }}
      hello: {{ .other.key }}
Step2: Run the robot

If you don't have a bot, you should create one first, see here.

TG_TOKEN=xxx gofbot run --adapter telegram
Step3: Get the webhook

Chat with your robot and get the webhook address.

Just send the command /get_webhook then the robot will send you the webhook address.

Step4: Post the webhook

Post any body to the webhook address, like this:

curl -X POST -H "Content-Type: application/json" -d '{"type": "xxCreate", "name": "xxx", "intro": "this is a test", "other": {"key": "world"}}' $WEBHOOK_URL

Supports

  • Telegram
  • Slack
  • RocketChat
  • Mattermost
  • Discord
  • Lark
  • DingTalk
  • WeCom

Documentation

Overview

Copyright © 2023 Ambor <saltbo@foxmail.com>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Directories

Path Synopsis
apis
Package cmd Copyright © 2023 Ambor <saltbo@foxmail.com>
Package cmd Copyright © 2023 Ambor <saltbo@foxmail.com>
pkg
bot

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL