Debian Codegraph @

pkg/services/sms/twilio/doc.go

raw
1 // Package twilio provides a notification service for sending SMS messages via the Twilio API.
2 //
3 // The twilio service allows sending SMS messages to phone numbers using the Twilio
4 // messaging API. It supports standard notification features including message titles
5 // and configurable sender/recipient phone numbers.
6 //
7 // # URL Format
8 //
9 // The service URL follows the format:
10 //
11 // twilio://accountSID:authToken@fromNumber/toNumber1[/toNumber2/...][?query]
12 //
13 // Where:
14 // - accountSID: Twilio Account SID (required)
15 // - authToken: Twilio Auth Token (required)
16 // - fromNumber: sender phone number in E.164 format, or Messaging Service SID (required)
17 // - toNumber: recipient phone number(s) in E.164 format (required)
18 // - query: configuration parameters
19 //
20 // # Basic Usage
21 //
22 // import "github.com/nicholas-fedor/shoutrrr/pkg/services/sms/twilio"
23 //
24 // service := &twilio.Service{}
25 // err := service.Initialize(url, logger)
26 // if err != nil {
27 // // handle error
28 // }
29 // err = service.Send("Hello via SMS!", nil)
30 //
31 // # Configuration Options
32 //
33 // The following query parameters can be used to configure the service:
34 //
35 // - title: notification title, prepended to the message body
36 //
37 // # Messaging Service SID
38 //
39 // If the fromNumber starts with "MG", it is treated as a Twilio Messaging Service SID
40 // and sent as the MessagingServiceSid parameter instead of From.
41 //
42 // # Phone Number Normalization
43 //
44 // Phone numbers are automatically normalized by stripping common formatting characters
45 // (spaces, dashes, parentheses, dots), leaving only digits and a leading '+'.
46 //
47 // # Important Notes
48 //
49 // - Multiple recipients can be specified by adding additional path segments
50 // - The To and From numbers must not be the same (Twilio rejects such requests)
51 // - Messaging Service SIDs bypass the To==From validation
52 // - Authentication uses HTTP Basic Auth with AccountSID and AuthToken
53 // - Requests are sent as application/x-www-form-urlencoded POST to the Twilio Messages API
54 package twilio