Head of Product & Engineering d081875fce fix: add uninstall handler, idempotency guard, and OAuth error handling
GHL Marketplace submission blockers resolved:
- Add POST /api/ghl/v1/webhook/uninstall to delete token on app removal
- Add in-memory messageId deduplication (10-min TTL) to prevent duplicate SMS sends on webhook retries
- Handle ?error= param in OAuth callback for user-denied auth flows
- Pass store to WebhookHandler; update tests accordingly

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-04-04 17:52:09 +02:00

46 lines
1.3 KiB
Go

package ghl
type TokenResponse struct {
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token"`
ExpiresIn int `json:"expires_in"`
TokenType string `json:"token_type"`
LocationID string `json:"locationId"`
CompanyID string `json:"companyId"`
UserType string `json:"userType"`
}
type OutboundMessageWebhook struct {
ContactID string `json:"contactId"`
LocationID string `json:"locationId"`
MessageID string `json:"messageId"`
Type string `json:"type"`
Phone string `json:"phone"`
Message string `json:"message"`
Attachments []string `json:"attachments"`
UserID string `json:"userId"`
}
type MessageStatusUpdate struct {
Status string `json:"status"`
ErrorCode string `json:"error_code,omitempty"`
ErrorMessage string `json:"error_message,omitempty"`
}
type UninstallWebhook struct {
LocationID string `json:"locationId"`
CompanyID string `json:"companyId"`
}
type InboundMessage struct {
Type string `json:"type"`
Message string `json:"message"`
Phone string `json:"phone"`
ConversationProviderID string `json:"conversationProviderId,omitempty"`
}
type InboundMessageResponse struct {
ConversationID string `json:"conversationId"`
MessageID string `json:"messageId"`
}