Versions in this module Expand all Collapse all v0 v0.1.1 Sep 24, 2026 v0.1.0 Sep 24, 2026 Changes in this version + const DefaultBaseURL + const DefaultSignatureTolerance + const SignatureHeader + const Version + var ErrInvalidArgument = errors.New("opensms: invalid argument") + func Bool(v bool) *bool + func Int(v int) *int + func VerifySignature(payload []byte, header, secret string, opts ...VerifyOptions) bool + type Analytics struct + func (r *Analytics) ByCarrier(ctx context.Context, params AnalyticsParams) ([]AnalyticsBreakdown, error) + func (r *Analytics) ByCountry(ctx context.Context, params AnalyticsParams) ([]AnalyticsBreakdown, error) + func (r *Analytics) BySenderID(ctx context.Context, params AnalyticsParams) ([]AnalyticsBreakdown, error) + func (r *Analytics) Overview(ctx context.Context, params AnalyticsParams) (*AnalyticsOverview, error) + func (r *Analytics) Timeseries(ctx context.Context, params AnalyticsParams) ([]AnalyticsPoint, error) + type AnalyticsBreakdown struct + Key string + Name string + type AnalyticsOverview struct + Currency string + Environment string + From time.Time + To time.Time + type AnalyticsParams struct + Bucket string + Currency string + From time.Time + Range string + To time.Time + type AnalyticsPoint struct + Bucket time.Time + type AssignNumberParams struct + Country string + Kind string + type Attempt struct + Currency string + DLRAt *time.Time + DLRLatencyMs *int64 + ErrorCode string + ID int64 + Price string + Provider string + ProviderMessageID string + RouteID string + RouteName string + Sequence int + Status string + SubmitLatencyMs *int64 + SubmittedAt *time.Time + type AvailableNumbersParams struct + Country string + Kind string + type Batch struct + CompletedAt *time.Time + CreatedAt time.Time + Delivered int + Duplicates int + EstimatedCost json.Number + Failed int + ID string + Invalid int + Sent int + Status string + Suppressed int + Total int + type BatchItem = Message + type BatchItemInput struct + CallbackURL string + Metadata map[string]any + SenderID string + Text string + To string + TrafficType string + type BatchStopResult struct + Cancelled int + ID string + Status string + type Batches struct + func (r *Batches) Create(ctx context.Context, params CreateBatchParams, opts ...CallOption) (*Batch, error) + func (r *Batches) CreateFromCSV(ctx context.Context, csv []byte, params CreateBatchFromCSVParams, ...) (*Batch, error) + func (r *Batches) Get(ctx context.Context, id string) (*Batch, error) + func (r *Batches) ListItems(ctx context.Context, id string, params ListBatchItemsParams) (*Page[BatchItem], error) + func (r *Batches) Start(ctx context.Context, id string, opts ...CallOption) (*Batch, error) + func (r *Batches) Stop(ctx context.Context, id string, opts ...CallOption) (*BatchStopResult, error) + func (r *Batches) Validation(ctx context.Context, id string) (*ValidationReport, error) + type CallOption func(*callOptions) + func WithIdempotencyKey(key string) CallOption + type Carrier struct + ID string + MCCMNC []string + Name string + Prefixes []string + type CheckSenderIDParams struct + Country string + Value string + type Client struct + Analytics *Analytics + Batches *Batches + Compliance *Compliance + ContactGroups *ContactGroups + Contacts *Contacts + Countries *Countries + Inbound *Inbound + Lookups *Lookups + Messages *Messages + Numbers *Numbers + OTP *OTP + Pricing *Pricing + Sandbox *Sandbox + SenderIDs *SenderIDs + Suppressions *Suppressions + Templates *Templates + Wallet *Wallet + Webhooks *Webhooks + func NewClient(apiKey string, opts ...Option) (*Client, error) + func (c *Client) Environment() string + type Compliance struct + func (r *Compliance) GetCountry(ctx context.Context, iso2 string) (*CountryRules, error) + func (r *Compliance) ListContentRules(ctx context.Context) ([]ContentRule, error) + func (r *Compliance) ListCountries(ctx context.Context) ([]CountryRules, error) + type Contact struct + Attributes map[string]any + CreatedAt time.Time + E164 string + ID string + Name string + WorkspaceID string + type ContactGroup struct + ContactIDs []string + CreatedAt time.Time + ID string + Name string + WorkspaceID string + type ContactGroups struct + func (r *ContactGroups) Create(ctx context.Context, params CreateContactGroupParams, opts ...CallOption) (*ContactGroup, error) + func (r *ContactGroups) Delete(ctx context.Context, id string) error + func (r *ContactGroups) Get(ctx context.Context, id string) (*ContactGroup, error) + func (r *ContactGroups) List(ctx context.Context, params ListParams) (*Page[ContactGroup], error) + func (r *ContactGroups) Send(ctx context.Context, id string, params GroupSendParams, opts ...CallOption) (*Batch, error) + func (r *ContactGroups) Update(ctx context.Context, id string, params UpdateContactGroupParams) (*ContactGroup, error) + type Contacts struct + func (r *Contacts) Create(ctx context.Context, params CreateContactParams, opts ...CallOption) (*Contact, error) + func (r *Contacts) Delete(ctx context.Context, id string) error + func (r *Contacts) Get(ctx context.Context, id string) (*Contact, error) + func (r *Contacts) List(ctx context.Context, params ListParams) (*Page[Contact], error) + func (r *Contacts) Update(ctx context.Context, id string, params UpdateContactParams) (*Contact, error) + type ContentRule struct + Action string + CountryISO2 string + Enabled bool + ID int64 + Kind string + Pattern string + TrafficTypes []string + type Countries struct + func (r *Countries) Carriers(ctx context.Context, iso2 string) ([]Carrier, error) + func (r *Countries) Compliance(ctx context.Context, iso2 string) (*CountryRules, error) + func (r *Countries) List(ctx context.Context) ([]Country, error) + func (r *Countries) Routes(ctx context.Context, iso2 string) ([]Route, error) + type Country struct + Currency string + DialCode string + ISO2 string + Name string + PricePerMessage *Money + ProvidersAvailable int + SenderKinds []string + Status string + type CountryContentRule struct + Action string + Enabled bool + Kind string + Pattern string + TrafficTypes []string + type CountryRules struct + ContentRules []CountryContentRule + DialCode string + ISO2 string + Name string + QuietHours []QuietHours + Status string + StopKeywords []string + type CreateBatchFromCSVParams struct + Dedupe *bool + type CreateBatchParams struct + Dedupe *bool + Items []BatchItemInput + type CreateContactGroupParams struct + ContactIDs []string + Name string + type CreateContactParams struct + Attributes map[string]any + E164 string + Name string + type CreateLookupParams struct + To string + type CreateSenderIDParams struct + Countries []string + Documents []string + DraftID string + DraftVersion *int + Kind string + QuoteID string + SampleMessage string + UseCase string + Value string + type CreateSuppressionParams = SuppressionInput + type CreateTemplateParams struct + Body string + Name string + TrafficType string + type CreateTopupParams struct + Amount string + Channel string + Currency string + Email string + type CreateWebhookParams struct + Enabled *bool + Events []string + URL string + type Cursorable interface + WithCursor func(cursor string) P + type Error struct + Body []byte + Code string + Detail string + Errors map[string][]string + RequestID string + RetryAfter time.Duration + Status int + Title string + TraceID string + Type string + func (e *Error) Error() string + func (e *Error) Message() string + func (e *Error) Unwrap() error + type GroupSendParams struct + CallbackURL string + SenderID string + TemplateID string + Text string + TrafficType string + Variables map[string]string + type Inbound struct + func (r *Inbound) List(ctx context.Context, params ListParams) (*Page[InboundMessage], error) + func (r *Inbound) Reply(ctx context.Context, id string, params InboundReplyParams, opts ...CallOption) (*Message, error) + type InboundMessage struct + From string + ID string + ReceivedAt time.Time + Text string + To string + VirtualNumberID string + type InboundReplyParams struct + Text string + type Iterator struct + func Paginate[T any, P Cursorable[P]](ctx context.Context, list func(context.Context, P) (*Page[T], error), params P) *Iterator[T, P] + func (it *Iterator[T, P]) Err() error + func (it *Iterator[T, P]) Item() T + func (it *Iterator[T, P]) Next() bool + type LedgerEntry struct + Amount string + BalanceAfter string + CreatedAt time.Time + ID int64 + MessageID string + PaymentID string + Reference string + ReservedAfter string + ReservedDelta string + Type string + WalletID string + type LedgerParams struct + Before int64 + Limit *int + type ListBatchItemsParams struct + Cursor string + Limit int + Status string + func (p ListBatchItemsParams) WithCursor(cursor string) ListBatchItemsParams + type ListFunc func(ctx context.Context, params P) (*Page[T], error) + type ListMessagesParams struct + Country string + Cursor string + DateFrom time.Time + DateTo time.Time + Limit int + Status string + To string + func (p ListMessagesParams) WithCursor(cursor string) ListMessagesParams + type ListParams struct + Cursor string + Limit int + func (p ListParams) WithCursor(cursor string) ListParams + type Lookup struct + Carrier *string + CheckedAt *time.Time + Country string + Currency string + ID string + Ported *bool + Price string + Source string + State string + Valid *bool + type Lookups struct + func (r *Lookups) Create(ctx context.Context, params CreateLookupParams, opts ...CallOption) (*Lookup, error) + func (r *Lookups) Get(ctx context.Context, id string) (*Lookup, error) + type Message struct + Billing []map[string]any + CancelledAt *time.Time + CarrierID string + CarrierName string + CountryID string + CountryISO2 string + CountryName string + CreatedAt time.Time + Currency string + DeliveredAt *time.Time + DestinationSource string + Encoding string + FailedAt *time.Time + ID string + Metadata map[string]any + Parts int + Price string + ScheduledAt *time.Time + SenderID string + SentAt *time.Time + Status string + StatusReason string + Text string + To string + TrafficType string + type Messages struct + func (r *Messages) Attempts(ctx context.Context, id string) ([]Attempt, error) + func (r *Messages) Cancel(ctx context.Context, id string) (*Message, error) + func (r *Messages) Get(ctx context.Context, id string) (*Message, error) + func (r *Messages) List(ctx context.Context, params ListMessagesParams) (*Page[Message], error) + func (r *Messages) Send(ctx context.Context, params SendMessageParams, opts ...CallOption) (*Message, error) + type Metrics struct + Delivered int64 + DeliveryRate float64 + Failed int64 + P50Ms *int64 + P95Ms *int64 + Parts int64 + Sent int64 + Spend string + type Money struct + Amount string + Currency string + type Number struct + AssignedAt *time.Time + Country string + FeeCurrency string + ID string + Inbound bool + Kind string + MonthlyFee string + Number string + Outbound bool + RenewsAt *time.Time + Status string + type NumberRule struct + Action string + ID string + Match string + Pattern string + Position int + Target string + type NumberRuleParams struct + Action string + Match string + Pattern string + Position int + Target string + type Numbers struct + func (r *Numbers) Assign(ctx context.Context, params AssignNumberParams, opts ...CallOption) (*Number, error) + func (r *Numbers) Available(ctx context.Context, params AvailableNumbersParams) ([]Number, error) + func (r *Numbers) CreateRule(ctx context.Context, id string, params NumberRuleParams, opts ...CallOption) (*NumberRule, error) + func (r *Numbers) DeleteRule(ctx context.Context, id, ruleID string) error + func (r *Numbers) List(ctx context.Context, params ListParams) (*Page[Number], error) + func (r *Numbers) ListRules(ctx context.Context, id string, params ListParams) (*Page[NumberRule], error) + func (r *Numbers) Release(ctx context.Context, id string) error + func (r *Numbers) UpdateRule(ctx context.Context, id, ruleID string, params NumberRuleParams) (*NumberRule, error) + type OTP struct + func (r *OTP) Send(ctx context.Context, params SendOTPParams, opts ...CallOption) (*OTPSendResult, error) + func (r *OTP) Verify(ctx context.Context, params VerifyOTPParams) (*OTPVerifyResult, error) + type OTPSendResult struct + OTPID string + type OTPVerifyResult struct + AttemptsLeft int + Valid bool + type Option func(*transport) + func WithBaseURL(baseURL string) Option + func WithHTTPClient(hc *http.Client) Option + func WithMaxRetries(maxRetries int) Option + func WithTimeout(timeout time.Duration) Option + type Page struct + Items []T + NextCursor string + func (p *Page[T]) HasMore() bool + type PriceEntry struct + CarrierID string + CarrierName string + ConvertedAmount *string + ConvertedCurrency string + CountryISO2 string + CountryName string + EffectiveFrom time.Time + FXRate string + MarkupType string + MarkupValue string + MinMonthlyVolume int64 + Product string + SellAmount *string + SellCurrency string + WorkspaceOverride bool + type PriceList struct + Currency string + Entries []PriceEntry + Product string + WorkspaceID string + type Pricing struct + func (r *Pricing) Get(ctx context.Context, params PricingParams) (*PriceList, error) + type PricingParams struct + Country string + Product string + type QuietHours struct + EndLocal string + Enforce string + StartLocal string + TrafficType string + type QuoteSenderIDParams struct + Countries []string + type ReplayDeliveryParams struct + Generation int + Reason string + type Route struct + Carrier string + Cost string + Currency string + Health string + P50Ms *int64 + Priority int + Provider string + SellPrice *Money + type Sandbox struct + func (r *Sandbox) ListMessages(ctx context.Context, params ListParams) (*Page[SandboxMessage], error) + type SandboxMessage struct + CreatedAt time.Time + ID string + Parts int + SenderID string + SentAt *time.Time + Status string + Text string + To string + TrafficType string + type SendMessageParams struct + CallbackURL string + Metadata map[string]any + ScheduledAt time.Time + SenderID string + Text string + To string + TrafficType string + func (p SendMessageParams) MarshalJSON() ([]byte, error) + type SendOTPParams struct + Length int + SenderID string + TTLSeconds int + Template string + To string + type SenderDocument struct + ContentType string + CreatedAt time.Time + Filename string + ID string + IsCurrent bool + Kind string + ReviewReason string + ReviewStatus string + ReviewedAt *time.Time + ScanStatus string + Size int64 + SupersedesID string + Version int + type SenderID struct + Countries []string + CreatedAt time.Time + ID string + Kind string + Registrations []map[string]any + RejectionReason string + Restricted bool + RestrictionReason string + SampleMessage string + Status string + UseCase string + Value string + type SenderIDCheck struct + Available bool + Reason string + Reserved bool + Valid bool + type SenderIDDraft struct + Countries []string + CreatedAt time.Time + Documents []string + ID string + Kind string + SampleMessage string + Source string + Status string + SubmittedSenderID *string + UpdatedAt time.Time + UseCase string + Value string + Version int + type SenderIDDraftParams struct + Countries []string + Documents []string + Kind string + SampleMessage string + Source string + UseCase string + Value string + type SenderIDQuote struct + Entries []SenderIDQuoteEntry + QuoteID string + Totals []Money + type SenderIDQuoteEntry struct + Country string + FeeAmount string + FeeCurrency string + Provider string + type SenderIDs struct + func (r *SenderIDs) Check(ctx context.Context, params CheckSenderIDParams) (*SenderIDCheck, error) + func (r *SenderIDs) Create(ctx context.Context, params CreateSenderIDParams) (*SenderID, error) + func (r *SenderIDs) CreateDraft(ctx context.Context, params SenderIDDraftParams) (*SenderIDDraft, error) + func (r *SenderIDs) Delete(ctx context.Context, id string) error + func (r *SenderIDs) DeleteDraft(ctx context.Context, id string) error + func (r *SenderIDs) Get(ctx context.Context, id string) (*SenderID, error) + func (r *SenderIDs) GetDraft(ctx context.Context, id string) (*SenderIDDraft, error) + func (r *SenderIDs) List(ctx context.Context, params ListParams) (*Page[SenderID], error) + func (r *SenderIDs) ListDocuments(ctx context.Context) ([]SenderDocument, error) + func (r *SenderIDs) ListDrafts(ctx context.Context, params ListParams) (*Page[SenderIDDraft], error) + func (r *SenderIDs) Quote(ctx context.Context, params QuoteSenderIDParams) (*SenderIDQuote, error) + func (r *SenderIDs) Update(ctx context.Context, id string, params UpdateSenderIDParams) (*SenderID, error) + func (r *SenderIDs) UpdateDraft(ctx context.Context, id string, params UpdateSenderIDDraftParams) (*SenderIDDraft, error) + type StatusResult struct + Status string + type Suppression struct + CreatedAt time.Time + E164 string + ID int64 + Reason string + type SuppressionImportResult struct + Created int + Received int + type SuppressionInput struct + E164 string + Reason string + type Suppressions struct + func (r *Suppressions) Create(ctx context.Context, params CreateSuppressionParams) (*Suppression, error) + func (r *Suppressions) Delete(ctx context.Context, id int64) error + func (r *Suppressions) Import(ctx context.Context, items []SuppressionInput) (*SuppressionImportResult, error) + func (r *Suppressions) List(ctx context.Context, params ListParams) (*Page[Suppression], error) + type Template struct + Body string + CreatedAt time.Time + ID string + Name string + TrafficType string + UpdatedAt time.Time + Variables []string + WorkspaceID string + type Templates struct + func (r *Templates) Create(ctx context.Context, params CreateTemplateParams, opts ...CallOption) (*Template, error) + func (r *Templates) Delete(ctx context.Context, id string) error + func (r *Templates) Get(ctx context.Context, id string) (*Template, error) + func (r *Templates) List(ctx context.Context, params ListParams) (*Page[Template], error) + func (r *Templates) Update(ctx context.Context, id string, params UpdateTemplateParams) (*Template, error) + type Topup struct + AccessCode string + Amount string + AuthorizationURL string + Currency string + ID string + Reference string + Status string + type UpdateContactGroupParams struct + ContactIDs []string + Name string + func (p UpdateContactGroupParams) MarshalJSON() ([]byte, error) + type UpdateContactParams struct + Attributes map[string]any + E164 string + Name string + type UpdateSenderIDDraftParams struct + Countries []string + Documents []string + Kind string + SampleMessage string + UseCase string + Value string + Version int + type UpdateSenderIDParams struct + Countries []string + Documents []string + SampleMessage string + UseCase string + type UpdateTemplateParams struct + Body string + Name string + TrafficType string + type UpdateWebhookParams struct + Enabled bool + Events []string + URL string + type ValidationReport struct + Duplicates int + Invalid int + Rows []ValidationRow + Suppressed int + Total int + Valid int + type ValidationRow struct + Duplicate bool + Error string + Item BatchItemInput + Row int + Suppressed bool + Valid bool + type VerifyOTPParams struct + Code string + OTPID string + type VerifyOptions struct + Now time.Time + Tolerance time.Duration + type Wallet struct + func (r *Wallet) Balances(ctx context.Context) ([]WalletBalance, error) + func (r *Wallet) CreateTopup(ctx context.Context, params CreateTopupParams, opts ...CallOption) (*Topup, error) + func (r *Wallet) Ledger(ctx context.Context, params LedgerParams) ([]LedgerEntry, error) + type WalletBalance struct + Balance string + Currency string + Environment string + ID string + Reserved string + type WebhookDelivery struct + Attempts int + CreatedAt time.Time + DeliveredAt *time.Time + Event string + Generation int + ID int64 + LastError string + LastResponseCode *int + NextRetryAt *time.Time + Payload any + Status string + type WebhookEndpoint struct + ConsecutiveFailures int + CreatedAt time.Time + DisabledAt *time.Time + Enabled bool + Events []string + ID string + Secret string + URL string + type WebhookEvent struct + CreatedAt time.Time + Data map[string]any + Environment string + ID string + Type string + WorkspaceID string + func ConstructEvent(payload []byte, header, secret string, opts ...VerifyOptions) (*WebhookEvent, error) + type Webhooks struct + func (r *Webhooks) ConstructEvent(payload []byte, header, secret string, opts ...VerifyOptions) (*WebhookEvent, error) + func (r *Webhooks) Create(ctx context.Context, params CreateWebhookParams, opts ...CallOption) (*WebhookEndpoint, error) + func (r *Webhooks) Delete(ctx context.Context, id string, opts ...CallOption) error + func (r *Webhooks) Get(ctx context.Context, id string) (*WebhookEndpoint, error) + func (r *Webhooks) List(ctx context.Context, params ListParams) (*Page[WebhookEndpoint], error) + func (r *Webhooks) ListDeliveries(ctx context.Context, id string, params ListParams) (*Page[WebhookDelivery], error) + func (r *Webhooks) ReplayDelivery(ctx context.Context, id string, deliveryID int64, params ReplayDeliveryParams, ...) (*StatusResult, error) + func (r *Webhooks) Test(ctx context.Context, id string, opts ...CallOption) (*StatusResult, error) + func (r *Webhooks) Update(ctx context.Context, id string, params UpdateWebhookParams, opts ...CallOption) (*WebhookEndpoint, error) + func (r *Webhooks) VerifySignature(payload []byte, header, secret string, opts ...VerifyOptions) bool