From 0f422146c4169cfa227666dfaa6f614193474d12 Mon Sep 17 00:00:00 2001 From: Sumner Evans Date: Tue, 26 Mar 2024 17:01:17 -0600 Subject: [PATCH] chatwoot: remove ability to set custom attributes Signed-off-by: Sumner Evans --- chatwoot.go | 2 -- chatwootapi/api.go | 19 ------------------- 2 files changed, 21 deletions(-) diff --git a/chatwoot.go b/chatwoot.go index 53a566a..1ed874b 100644 --- a/chatwoot.go +++ b/chatwoot.go @@ -191,7 +191,6 @@ func main() { }) syncer.OnEventType(event.EventReaction, func(ctx context.Context, evt *event.Event) { ctx = addEvtContext(ctx, evt) - stateStore.UpdateMostRecentEventIDForRoom(ctx, evt.RoomID, evt.ID) if VerifyFromAuthorizedUser(ctx, evt.Sender) { go HandleReaction(ctx, evt) @@ -199,7 +198,6 @@ func main() { }) syncer.OnEventType(event.EventRedaction, func(ctx context.Context, evt *event.Event) { ctx = addEvtContext(ctx, evt) - stateStore.UpdateMostRecentEventIDForRoom(ctx, evt.RoomID, evt.ID) if VerifyFromAuthorizedUser(ctx, evt.Sender) { go HandleRedaction(ctx, evt) diff --git a/chatwootapi/api.go b/chatwootapi/api.go index 530f47f..270d5fa 100644 --- a/chatwootapi/api.go +++ b/chatwootapi/api.go @@ -263,25 +263,6 @@ func (api *ChatwootAPI) SetConversationLabels(conversationID int, labels []strin return nil } -func (api *ChatwootAPI) SetConversationCustomAttributes(conversationID int, customAttrs map[string]string) error { - jsonValue, _ := json.Marshal(map[string]any{ - "custom_attributes": customAttrs, - }) - req, err := http.NewRequest(http.MethodPost, api.MakeUri(fmt.Sprintf("conversations/%d/custom_attributes", conversationID)), bytes.NewBuffer(jsonValue)) - if err != nil { - return err - } - - resp, err := api.DoRequest(req) - if err != nil { - return err - } - if resp.StatusCode != 200 { - return fmt.Errorf("POST conversations/%d/custom_attributes returned non-200 status code: %d", conversationID, resp.StatusCode) - } - return nil -} - func (api *ChatwootAPI) doSendTextMessage(ctx context.Context, conversationID int, jsonValues map[string]any) (*Message, error) { log := zerolog.Ctx(ctx).With().Str("component", "send_text_message").Logger() jsonValue, err := json.Marshal(jsonValues)