summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/command.go2
-rw-r--r--app/webhook.go6
2 files changed, 5 insertions, 3 deletions
diff --git a/app/command.go b/app/command.go
index 0763e24c7..1eaf304ad 100644
--- a/app/command.go
+++ b/app/command.go
@@ -239,6 +239,8 @@ func (a *App) HandleCommandResponse(command *model.Command, args *model.CommandA
post.RootId = args.RootId
post.ParentId = args.ParentId
post.UserId = args.UserId
+ post.Type = response.Type
+ post.Props = response.Props
if !builtIn {
post.AddProp("from_webhook", "true")
diff --git a/app/webhook.go b/app/webhook.go
index 380839cdc..9531cba10 100644
--- a/app/webhook.go
+++ b/app/webhook.go
@@ -105,10 +105,10 @@ func (a *App) TriggerWebhook(payload *model.OutgoingWebhookPayload, hook *model.
l4g.Error(utils.T("api.post.handle_webhook_events_and_forget.event_post.error"), err.Error())
} else {
defer CloseBody(resp)
- respProps := model.MapFromJson(resp.Body)
+ webhookResp := model.OutgoingWebhookResponseFromJson(resp.Body)
- if text, ok := respProps["text"]; ok {
- if _, err := a.CreateWebhookPost(hook.CreatorId, channel, text, respProps["username"], respProps["icon_url"], post.Props, post.Type); err != nil {
+ if webhookResp != nil && webhookResp.Text != nil {
+ if _, err := a.CreateWebhookPost(hook.CreatorId, channel, *webhookResp.Text, webhookResp.Username, webhookResp.IconURL, webhookResp.Props, webhookResp.Type); err != nil {
l4g.Error(utils.T("api.post.handle_webhook_events_and_forget.create_post.error"), err)
}
}