/MessagePusher

a simple dotnet core application for webhooks

Primary LanguageC#

MessagePusher

a dotnet core application for webhooks

install dotnet core environment

how to

  • install dotnet core environment
  • clone project
  • cd project and run dotnet restore
  • run dotnet publish -c Release -o /home/MessagePusher/publish
  • cd publish folder and run dotnet MessagePusher.Web.dll

run with supervisor

  • ref
    doc/supervisor.conf

run with docker

  • docker-compose up -d

usage

  • reload config file without restart app request http://{your_host}:8001/api/reload

  • set message senders

    • edit /publish/config.json, add:
      "Sender": {
          "{your sender name}": {
              "Type": "{required, sender type}",
              "{xxx}": "{sender config field}"
          }
      }
      e.g.
      "Sender": {
          "SendToAlice": {
              "Type": "ServerJiang",
              "Token": ""
          },
          "SendToBob": {
              "Type": "Telegram",
              "Token": "",
              "ChatId": ""
          },
          "SendToCarol": {
              "Type": "Slack",
              "Webhook": "https://hooks.slack.com/services/{{service token}}"
          }
      }
      💡 telegram: follow this link to get your chat id
      💡 slack: follow this link to set your incoming webhooks
  • web hook
    e.g. Github

    • Payload URL http://{your_host}:8001/api/github
    • content-type application/json
    • set config edit /publish/config.json, add:
      "Receiver": {
          "GitHub": {
              "Token": "",
              "SendTo": [ "your sender name" ]
          }
      }
  • simple site monitor service

    • config
      "Receiver": {
          "SiteMonitor": {
              "Sites": [ "{your site, e.g. https://i.caoyue.me/}" ],
              "SendTo": [ "{your sender name}" ]
          }
      }
    • cronjob
      */5 * * * * curl http://{your_host}:8001/api/sitemonitor >/dev/null 2>&1
      
  • twitch stream notification

    • config
      "Receiver": {
          "Twitch": {
              "Channels": [ "{twitch channel id}" ],
              "ClientId": "{your client id}",
              "SendTo": [ "{your sender name}" ]
          }
      }
      💡 To get a client ID, register a developer application on the connections page of your Twitch account.
    • cronjob
      */5 * * * * curl http://{your_host}:8001/api/douyu >/dev/null 2>&1
      
  • 斗鱼开播提醒

    • config
      "Receiver": {
          "DouYu": {
              "Rooms": [ "{douyu room id}" ], 
              "SendTo": [ "{your sender name}" ]
          }
      }
      需要提醒的房间 id 填入 Rooms
    • 设置 cronjob
      */5 * * * * curl http://{your_host}:8001/api/douyu >/dev/null 2>&1