Head of Product & Engineering 59b0a8c93f
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
fix: switch location lookup to /oauth/installedLocations (oauth.readonly scope)
/locations/search requires locations.readonly which GHL never includes in
company-level OAuth tokens. /oauth/installedLocations uses oauth.readonly,
which is always present in company tokens, and returns only locations where
this app is actually installed.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-04-06 10:57:16 +02:00

58 lines
1.8 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"`
InstalledLocations []string `json:"installedLocations"` // populated on bulk company installs
}
// LocationInfo represents a GHL location entry from the /oauth/installedLocations response.
type LocationInfo struct {
ID string `json:"_id"` // /oauth/installedLocations uses _id
Name string `json:"name"`
}
type InstalledLocationsResponse struct {
Locations []LocationInfo `json:"locations"`
Count int `json:"count"`
}
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"`
}