Go-Simp icon indicating copy to clipboard operation
Go-Simp copied to clipboard

Add webhook for form feature

Open futag opened this issue 3 years ago • 12 comments

Continue issue https://github.com/JustHumanz/Go-Simp/issues/296, maybe add some api webhook to Vtbot discord server to easier add and change vtuber state without login to github

futag avatar Jul 12 '22 00:07 futag

let me think for the flow

JustHumanz avatar Jul 13 '22 12:07 JustHumanz

Example, when send request post api, automatic send in webhook discord

futag avatar Jul 14 '22 00:07 futag

yeah, it's simple but can be dangerous if someone abuses the API

anyway, any idea about the payload? should like this?

{
 "vtuber": "blabla",
 "current_state" : "Active",
 "update_state": "Inactive",
}

JustHumanz avatar Jul 16 '22 11:07 JustHumanz

yeah, but in 2 statement

  • Add new vtuber
  • edit current stage

But this playload like this

{
  "id": 1,
  "old" {
    "key": "value",
  },
  "new": {
    "key": "value"
  }
}

futag avatar Jul 16 '22 17:07 futag

there may be data that is deleted, data that is added, or there is also data that is changed

futag avatar Jul 16 '22 17:07 futag

Here for the json object request

Add

{
        "Name": "Kanochi",
        "EN_Name": "Mahoro Kano",
        "JP_Name": "鹿乃",
        "Twitter": {
            "Twitter_Fanart": "#まほろ絵",
            "Twitter_Lewd": "",
            "Twitter_Username": "kanomahoro"
        },
        "Youtube": null,
        "BiliBili": {
            "BiliBili_Fanart": "鹿乃絵",
            "BiliBili_ID": 316381099,
            "BiliRoom_ID": 15152878
        },
        "Twitch": null,
        "Region": "JP",
        "Fanbase": "",
    }

Update

{
    "ID": 14,
    "Old": {
        "Name": "Kanochi",
        "EN_Name": "Mahoro Kano",
        "JP_Name": "鹿乃",
        "Twitter": {
            "Twitter_Fanart": "#まほろ絵",
            "Twitter_Lewd": "",
            "Twitter_Username": "kanomahoro"
        },
        "Youtube": null,
        "BiliBili": {
            "BiliBili_Fanart": "鹿乃絵",
            "BiliBili_ID": 316381099,
            "BiliRoom_ID": 15152878
        },
        "Twitch": null,
        "Region": "JP",
        "Fanbase": "",
        "Status": "Active"
    },
    "New": {
        "Name": "Kanochi",
        "EN_Name": "Mahoro Kano",
        "JP_Name": "鹿乃",
        "Twitter": {
            "Twitter_Fanart": "#まほろ絵",
            "Twitter_Lewd": "",
            "Twitter_Username": "bambi2525"
        },
        "Youtube": {
            "Youtube_ID": "UCfuz6xYbYFGsWWBi3SpJI1w"
        },
        "BiliBili": {
            "BiliBili_Fanart": "鹿乃絵",
            "BiliBili_ID": 316381099,
            "BiliRoom_ID": 15152878
        },
        "Twitch": null,
        "Region": "JP",
        "Fanbase": "",
        "Status": "Active"
    }
}

JustHumanz avatar Jul 21 '22 15:07 JustHumanz

for add, don't include status

futag avatar Jul 21 '22 15:07 futag

ah yeah,sure

JustHumanz avatar Jul 21 '22 15:07 JustHumanz

for add only active members

futag avatar Jul 21 '22 15:07 futag

Webhook already deployed

Add vtuber request

  • Method : POST
  • URL : https://api.humanz.moe/v2/member/request/add

Edit vtuber request

  • Method : PATCH
  • URL : https://api.humanz.moe/v2/member/request/edit

JustHumanz avatar Jul 22 '22 13:07 JustHumanz

Add additional do adding and change group/agency (like members)

{
  "GroupName": "a Agency",
  "Icon_URL": "https://example.jp/icon.png", // For Download and add to storage
  "GroupChannel": {
    "Youtube": [
      {
        "Youtube_ID": "UCfuz6xYbYFGsWWBi3SpJI1w",
         "Region": "EN",
      }
    ],
   "BiliBili": null
  }
}

and adding Group filed inside member webhooks (using group name or group id)

  "Name": "Kanochi",
  "EN_Name": "Mahoro Kano",
  "JP_Name": "鹿乃",
  "Group": "Independent",

or

  "Name": "Kanochi",
  "EN_Name": "Mahoro Kano",
  "JP_Name": "鹿乃",
  "Group": 10,

futag avatar Aug 01 '22 00:08 futag

Add & Change for group agency already added, example json :

{
	"GroupName": "ArkNET",
	"GroupIcon": "https://cdn.humanz.moe/ArkNet.png",
	"GroupChannel": {
		"Youtube": null,
		"BiliBili": null
	},
	"Members": [
		{
			"Name": "Enji_NC",
			"EN_Name": "Enji Notokunchoro",
			"JP_Name": "",
			"Twitter": {
				"Twitter_Fanart": "#Enji_Art",
				"Twitter_Lewd": "",
				"Twitter_Username": "Enji_NC"
			},
			"Youtube": {
				"Yt_ID": "UCoKQhFQUtg6H09u6fHFN1AA"
			},
			"BiliBili": null,
			"Twitch": null,
			"Region": "ID",
			"Fanbase": "",
			"Status": "Active"
		}
	]
}

When adding agency group the member data can't be null, member data should be filled

JustHumanz avatar Aug 13 '22 08:08 JustHumanz