slack app boilerplate
1.0.0
แต่ละคำสั่งจะถูกเปลี่ยนเส้นทางไปยังคอนโทรลเลอร์ MVC
ตัวอย่างเช่น
/[command] list
มันจะถูกเปลี่ยนเส้นทางไปยัง /api/list
/[command] list something
มันจะถูกเปลี่ยนเส้นทางไปยัง /api/list/something
/[command] list something extra things
จะถูกเปลี่ยนเส้นทางไปยัง /api/list/something?extraParameters=extra+things
Peasy ง่าย
ใช้ [SlackAuthentication] :
คำขอทั้งหมดของคุณได้รับการตรวจสอบแล้วดังนั้นคุณรู้ว่าพวกเขามาจาก Slack จริงๆ
โดยใช้:
[SlackAuthorizeByUser(authorizedUsernames: new[] {"luciansr"})]
คุณสามารถมั่นใจได้ว่ามีเพียง "Luciansr" เท่านั้นที่ได้รับอนุญาตให้ดำเนินการเส้นทางของคุณ
[SlackAuthorizeByUser(authorizedChannels: new[] {"general"})]
คุณสามารถมั่นใจได้ว่าคำขอจากช่อง "ทั่วไป" เท่านั้นที่ได้รับอนุญาตให้ดำเนินการเส้นทางของคุณ
curl -X POST
http://localhost:5001/api/slack2
-H 'Content-Type: application/x-www-form-urlencoded'
-H 'cache-control: no-cache'
-H 'x-slack-request-timestamp: 1561931414'
-H 'x-slack-signature: v0=283155a3328d9cfd2a3308c566ca68fe4bd59088f14a8c1497662b52d633ecaf'
-d 'token=8O4s3rgvVFjHTv3aAVtbo2FP&team_id=TKVHCH21L&team_domain=luciandev&channel_id=CKSUPQ31A&channel_name=general&user_id=UKG1CTVU3&user_name=luciansr&command=%2Flucian&text=list&response_url=https%3A%2F%2Fhooks.slack.com%2Fcommands%2FTKVHCH21L%2F682573638535%2FnJeeLss5of7MRLAkdPn9sm3C&trigger_id=669321780995.675590580054.5a199315fdefcc23c84eb3042b4100d1'
สิ่งที่คุณต้องทำเพื่อเริ่มเขียนโค้ด