Karta.Messaging.SenderId (Karta v1.0.0)

The sender of an SMS (from), by Bird's rules (bird.com/docs/guides/sms/sending-sms):

  • alphanumeric: 3 to 11 characters from letters, digits, spaces, dashes, underscores or dots, at least one letter, no separator at either end. Customers cannot reply to it, and some countries need it registered or do not allow it (the provider answers SMSAlphaNotSupported);
  • a number: E.164 or bare digits that the workspace owns.

normalise/1 cuts a company name to a valid alphanumeric sender (the way a sign-in code's sender is made: "Bloemen Winkel Kralendijk" becomes "Bloemen Win").

Summary

Functions

True for a valid alphanumeric sender.

A company name as a valid alphanumeric sender, or nil when nothing valid is left.

True for an E.164 number or bare digits.

Whether the text is a valid sender.

Functions

alphanumeric?(from)

@spec alphanumeric?(String.t()) :: boolean()

True for a valid alphanumeric sender.

normalise(name)

@spec normalise(term()) :: String.t() | nil

A company name as a valid alphanumeric sender, or nil when nothing valid is left.

number?(from)

@spec number?(String.t()) :: boolean()

True for an E.164 number or bare digits.

valid?(from)

@spec valid?(term()) :: boolean()

Whether the text is a valid sender.