MCPcopy
hub / github.com/the-open-agent/openagent / SetPipeWebhook

Method SetPipeWebhook

controllers/pipe.go:167–198  ·  view source on GitHub ↗

SetPipeWebhook calls the pipe's chat platform API to register the webhook URL. @Title SetPipeWebhook @Tag Pipe API @Description set webhook for a pipe @Param id query string true "The id of the pipe (owner/name)" @Success 200 {object} controllers.Response The Response object @router /api/set-pipe-we

()

Source from the content-addressed store, hash-verified

165// @Success 200 {object} controllers.Response The Response object
166// @router /api/set-pipe-webhook [post]
167func (c *ApiController) SetPipeWebhook() {
168 id := c.Input().Get("id")
169
170 pipe, err := object.GetPipe(id)
171 if err != nil {
172 c.ResponseError(err.Error())
173 return
174 }
175 if pipe == nil {
176 c.ResponseError("pipe not found")
177 return
178 }
179
180 pipeObj, err := pipe.GetProvider(c.GetAcceptLanguage())
181 if err != nil {
182 c.ResponseError(err.Error())
183 return
184 }
185
186 if pipe.Domain == "" {
187 c.ResponseError("Domain is not set on this pipe")
188 return
189 }
190
191 webhookUrl := fmt.Sprintf("%s/api/chat-webhook/%s/%s", pipe.Domain, pipepkg.NormalizeType(pipe.Type), pipe.Name)
192 if err = pipeObj.SetWebhook(webhookUrl); err != nil {
193 c.ResponseError(err.Error())
194 return
195 }
196
197 c.ResponseOk(webhookUrl)
198}
199
200// ChatTest sends a test message through the pipe to verify the full pipeline.
201// @Title ChatTest

Callers

nothing calls this directly

Calls 7

ResponseErrorMethod · 0.95
GetAcceptLanguageMethod · 0.95
ResponseOkMethod · 0.95
GetPipeFunction · 0.92
ErrorMethod · 0.80
SetWebhookMethod · 0.65
GetProviderMethod · 0.45

Tested by

no test coverage detected