feat(csat): queue channel templates

This commit is contained in:
2026-06-05 17:40:04 +08:00
parent 9a1813485f
commit 7ae38d020d
9 changed files with 547 additions and 30 deletions
@@ -91,6 +91,21 @@ func (s *InboxCsatTemplateHandlerTestSuite) TestCreate_BadRequest_InvalidInboxID
assert.Equal(s.T(), http.StatusBadRequest, w.Code)
}
func (s *InboxCsatTemplateHandlerTestSuite) TestCreate_ChatwootNestedTemplatePayload() {
r := gin.New()
r.POST("/api/v1/accounts/:account_id/inboxes/:inbox_id/csat_template", s.handler.Create)
w := httptest.NewRecorder()
body := bytes.NewBufferString(`{"template":{"message":"Please rate our support","button_text":"Rate us","language":"en"}}`)
req, _ := http.NewRequest("POST", fmt.Sprintf("/api/v1/accounts/%d/inboxes/%d/csat_template", s.account.ID, s.inbox.ID), body)
req.Header.Set("Content-Type", "application/json")
r.ServeHTTP(w, req)
assert.Equal(s.T(), http.StatusCreated, w.Code)
assert.Contains(s.T(), w.Body.String(), "Please rate our support")
assert.Contains(s.T(), w.Body.String(), "PENDING")
}
func (s *InboxCsatTemplateHandlerTestSuite) TestAnalyze_BadRequest_InvalidInboxID() {
r := gin.New()
r.POST("/api/v1/accounts/:account_id/inboxes/:inbox_id/csat_template/analyze", s.handler.Analyze)
@@ -101,4 +116,4 @@ func (s *InboxCsatTemplateHandlerTestSuite) TestAnalyze_BadRequest_InvalidInboxI
r.ServeHTTP(w, req)
assert.Equal(s.T(), http.StatusBadRequest, w.Code)
}
}