Liking cljdoc? Tell your friends :D

external

External third-party service adapters following the FC/IS pattern. Three active adapters: SMTP, IMAP, and Twilio.

Stripe payments have moved to payments library.

Key namespaces

boundary.external.schema              — Malli schemas for all three adapters
boundary.external.ports               — Protocols: ISmtpProvider, IImapMailbox,
                                        ITwilioMessaging
boundary.external.core.smtp           — Pure SMTP helpers
boundary.external.core.imap           — Pure IMAP helpers
boundary.external.core.twilio         — Pure Twilio helpers (build SMS/WhatsApp params)
boundary.external.shell.adapters.smtp — SmtpProviderAdapter (javax.mail)
boundary.external.shell.adapters.imap — ImapMailboxAdapter (javax.mail, UIDFolder)
boundary.external.shell.adapters.twilio  — TwilioAdapter (clj-http, Basic auth)

Enabling adapters

All three adapters ship as :inactive in config.edn. Move to :active to enable:

;; In :active section of resources/conf/dev/config.edn

:boundary.external/twilio
{:account-sid #env TWILIO_ACCOUNT_SID
 :auth-token  #env TWILIO_AUTH_TOKEN
 :from-number #env TWILIO_FROM_NUMBER}

:boundary.external/smtp
{:host     #env SMTP_HOST
 :port     587
 :username #env SMTP_USERNAME
 :password #env SMTP_PASSWORD
 :tls?     true}

:boundary.external/imap
{:host     #env IMAP_HOST
 :port     993
 :username #env IMAP_USERNAME
 :password #env IMAP_PASSWORD
 :ssl?     true}

Twilio SMS / WhatsApp

(require '[boundary.external.ports :as ports])

;; Send SMS
(ports/send-sms twilio {:to "+31612345678" :body "Your code: 123456"})

;; Send WhatsApp
(ports/send-whatsapp twilio {:to "+31612345678" :body "Your order has shipped!"})

Testing

clojure -M:test:db/h2 :external

Can you improve this documentation?Edit on GitHub

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close