All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
GHL includes installedLocations[] in the company-level token response for bulk installs. Use those IDs directly to avoid calling /locations/search, which requires locations.readonly scope that GHL doesn't grant. Falls back to /locations/search only when the list is absent. Also adds raw_body and installed_locations fields to token response debug logging. Co-Authored-By: Paperclip <noreply@paperclip.ing>
56 lines
1.6 KiB
Go
56 lines
1.6 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
|
|
}
|
|
|
|
type LocationInfo struct {
|
|
ID string `json:"id"`
|
|
Name string `json:"name"`
|
|
}
|
|
|
|
type LocationsResponse struct {
|
|
Locations []LocationInfo `json:"locations"`
|
|
}
|
|
|
|
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"`
|
|
}
|