Skip to content

Commit

Permalink
Merge pull request #9 from a-company-jp/feature/vonage/webhook/define…
Browse files Browse the repository at this point in the history
…-request

🏷️ [Add] `VonageWebhookRequest`
  • Loading branch information
Shion1305 authored Oct 11, 2024
2 parents 650dfb8 + 15643b9 commit 725a553
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion pkg/handler/vonage.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@ package handler

import "github.com/gin-gonic/gin"

type VonageWebhookRequest struct {
AgentID string `json:"agent_id"`
SessionID string `json:"session_id"`
ConversationID string `json:"conversation_id"`
Feeling string `json:"feeling"`
PhoneNumber string `json:"phone_number"`
Message string `json:"message"`
TodayActivity string `json:"today_activity"`
}

type VonageWebhook struct {
}

Expand All @@ -10,7 +20,13 @@ func NewVonageWebhook() *VonageWebhook {
}

func (v *VonageWebhook) Handle(c *gin.Context) {
var req VonageWebhookRequest
if err := c.ShouldBindJSON(&req); err != nil {
c.JSON(400, gin.H{"error": err.Error()})
return
}
// TODO: forward the request to LINE
c.JSON(200, gin.H{
"message": "Hello World",
"message": "success",
})
}

0 comments on commit 725a553

Please sign in to comment.