The sendgrid Reference Manual

This is the sendgrid Reference Manual, version 0.1, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Dec 15 05:22:44 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

The main system appears first, followed by any subsystem dependency.


2.1 sendgrid

Wrapper to SendGrid’s API.

Author

vindarel

License

MIT

Version

0.1

Dependencies
  • dexador (system).
  • jonathan (system).
  • qbase64 (system).
  • alexandria (system).
Source

sendgrid.asd.

Child Component

src (module).


3 Modules

Modules are listed depth-first from the system components tree.


3.1 sendgrid/src

Source

sendgrid.asd.

Parent Component

sendgrid (system).

Child Component

sendgrid.lisp (file).


4 Files

Files are sorted by type and then listed depth-first from the systems components trees.


4.1 Lisp


4.1.1 sendgrid/sendgrid.asd

Source

sendgrid.asd.

Parent Component

sendgrid (system).

ASDF Systems

sendgrid.


4.1.2 sendgrid/src/sendgrid.lisp

Source

sendgrid.asd.

Parent Component

src (module).

Packages

sendgrid.

Public Interface
Internals

5 Packages

Packages are listed by definition order.


5.1 sendgrid

Source

sendgrid.lisp.

Use List

common-lisp.

Public Interface
Internals

6 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


6.1 Public Interface


6.1.1 Special variables

Special Variable: *api-key-environment-variable-name*
Package

sendgrid.

Source

sendgrid.lisp.

Special Variable: *verbose*
Package

sendgrid.

Source

sendgrid.lisp.


6.1.2 Ordinary functions

Function: add-contact-to-list (&key email firstname list-id api-key)

Add a single contact to a sendgrid list.

To trigger an automation, login to Sendgrid and, in the marketing -> automation section, create an automation that triggers on adding a contact to a list.

Package

sendgrid.

Source

sendgrid.lisp.

Function: now-plus-n-days (days)

Sendgrid api allows you to send emails up to 3 days (72 hours) in the future

Specify n days in the future where n is either 1, 2, or 3 days.

A unix time for that date will be returned. If any other number of days is provided, the now function will return.

Package

sendgrid.

Source

sendgrid.lisp.

Function: send-email (&rest rest &key to from subject content reply-to content-type attachments file filename api-key &allow-other-keys)

Send an email with SendGrid’s API. https://docs.sendgrid.com/api-reference/mail-send/mail-send#body Currently only supporting basic parameters for 80% use cases.

Notice that ‘reply-to’, if not nil, should be an alist as (("email" . string) ("name" . string))

Package

sendgrid.

Source

sendgrid.lisp.


6.2 Internals


6.2.1 Special variables

Special Variable: *one-day-in-seconds*

one day less 1000 seconds

Package

sendgrid.

Source

sendgrid.lisp.

Special Variable: *sendgrid-api*
Package

sendgrid.

Source

sendgrid.lisp.

Special Variable: *sendgrid-contact-api-url*

The API URL for adding contacts to marketing lists within Sendgrid.

Package

sendgrid.

Source

sendgrid.lisp.


6.2.2 Ordinary functions

Function: contact-json (&key email firstname list-id)

The JSON object sent as a POST request for subscribing a single contact to a marketing list.

Package

sendgrid.

Source

sendgrid.lisp.

Function: create-attachment-base64 (file)

A function that converts a file into a base64 string. Base64 is the required format for sending attachments in emails.

Package

sendgrid.

Source

sendgrid.lisp.

Function: ensure-list (list)

If LIST is a list, it is returned. Otherwise returns the list designated by LIST. (from Alexandria)

Package

sendgrid.

Source

sendgrid.lisp.

Function: file-to-seq (file)

Convert a file into a sequence of bytes. Works with PDF and TXT files

Package

sendgrid.

Source

sendgrid.lisp.

Function: now ()

Unix time now

Package

sendgrid.

Source

sendgrid.lisp.

Function: sendgrid-json (&key to from from-name reply-to subject send-at attachments file filename content-type content-value &allow-other-keys)

Build the data json.
‘to’: one email address or a list.
‘reply-to’: a pair of email and name.
‘from’: the sending email
‘from-name’: the sending name that shows up in the inbox

Package

sendgrid.

Source

sendgrid.lisp.

Function: seq-to-base64 (seqs)

Convert a sequence of bytes into a base64 string.

Package

sendgrid.

Source

sendgrid.lisp.


Appendix A Indexes


A.1 Concepts