Spaces:
Paused
Paused
ML Intern deploy
Deploy httpSMS gateway to Hugging Face Spaces (Docker SDK): nginx :7860 -> Go API :8000, Nuxt SPA, Android APK, bootstrap-mode entrypoint
83a59ca Download api/pkg/requests/integration_3cx_message_request.go from red-kit/httpsms-gateway: direct link, hf CLI and curl.
- Browser
- Download file 1.29 kB
-
https://huggingface.co/spaces/red-kit/httpsms-gateway/resolve/main/api/pkg/requests/integration_3cx_message_request.go
- Command line
-
hf download hf://spaces/red-kit/httpsms-gateway/api/pkg/requests/integration_3cx_message_request.go
-
curl -L -o integration_3cx_message_request.go https://huggingface.co/spaces/red-kit/httpsms-gateway/resolve/main/api/pkg/requests/integration_3cx_message_request.go
1.29 kB
| package requests | |
| import ( | |
| "time" | |
| "github.com/NdoleStudio/httpsms/pkg/entities" | |
| "github.com/nyaruka/phonenumbers" | |
| "github.com/NdoleStudio/httpsms/pkg/services" | |
| ) | |
| // Integration3CXMessage is the payload for sending and SMS message via 3CX | |
| type Integration3CXMessage struct { | |
| request | |
| From string `json:"from" example:"+18005550199"` | |
| To string `json:"to" example:"+18005550100"` | |
| Text string `json:"text" example:"This is a sample text message"` | |
| } | |
| // Sanitize sets defaults to MessageReceive | |
| func (input *Integration3CXMessage) Sanitize() Integration3CXMessage { | |
| input.To = input.sanitizeAddress(input.To) | |
| input.From = input.sanitizeAddress(input.From) | |
| return *input | |
| } | |
| // ToMessageSendParams converts Integration3CXMessage to services.MessageSendParams | |
| func (input *Integration3CXMessage) ToMessageSendParams(userID entities.UserID, source string) services.MessageSendParams { | |
| from, _ := phonenumbers.Parse(input.From, phonenumbers.UNKNOWN_REGION) | |
| return services.MessageSendParams{ | |
| Source: source, | |
| Owner: from, | |
| RequestID: input.sanitizeStringPointer("integration-3cx"), | |
| UserID: userID, | |
| RequestReceivedAt: time.Now().UTC(), | |
| Contact: input.sanitizeAddress(input.To), | |
| Content: input.Text, | |
| } | |
| } | |