source: project/wiki/eggref/4/send-grid @ 39087

Last change on this file since 39087 was 39087, checked in by svnwiki, 3 months ago

Anonymous wiki edit for IP [73.189.230.121]: Updating library to match the SendGrid? v3 API as v2 is being discontinued.

File size: 2.7 KB
Line 
1== Send Grid
2
3[[toc:]]
4
5=== Description
6
7Provides a very simply api for sending email via [[http://sendgrid.com/|SendGrid]]. The api uses SendGrid's [[http://docs.sendgrid.com/documentation/api/web-api/mail/|web api]]. Currently only the sending of mail is supported, but other parts of the web api could be easily added.
8
9=== Repository
10
11[[https://github.com/ThomasHintz/chicken-scheme-send-grid]]
12
13=== Author
14
15[[/users/thomas-hintz|Thomas Hintz]]
16
17Contact me at t@thintz.com.
18
19=== Requirements
20
21* [[HTTP Client]]
22* [[URI Common]]
23* [[Intarweb]]
24* [[JSON]]
25* [[SRFI-1]]
26* [[SRFI-18]]
27* [[base64]]
28
29=== List of Parameters
30
31==== {{api-user}}
32<parameter>(api-user user)</parameter>
33
34This is your SendGrid api user specified as a string.
35
36==== {{api-key}}
37<parameter>(api-key key)</parameter>
38
39This is your SendGrid api key specified as a string.
40
41==== {{api-version}}
42<parameter>(api-version version)</parameter>
43
44A string indicating the SendGrid API version to use. The default is "2". Version "3" is also supported. After December 9th, 2020, this library may set the default to "3" when support for version 2 is officially ended.
45
46As far as this library's interface, the input and output are the same for both API versions.
47
48=== List of Procedures
49
50==== {{send-mail}}
51<procedure>(send-mail #!key (subject #f) (text #f) (html #f) (from #f) (from-name #f) (to #f) (reply-to #f) (api-user (api-user)) (api-key (api-key)) files)</procedure>
52
53Takes all the required arguments, passes a request on to SendGrid, and returns the SendGrid response in list form. {{api-user}} and {{api-key}} are optional if you specified them as parameters.
54
55Only {{html}} or {{text}} needs to be specified. If {{html}} is specified, then the resulting email will be in HTML format. If both {{html}} and {{text}} are specified, then the resulting email will only include the contents of {{html}}.
56
57{{files}} is optional and is a list of alists containing file attachments. The alist for each file must contain the key {{filename}} -- a string, {{filepath}} -- a string, and {{content-type}} -- a symbol. Example:
58
59<enscript highlight=scheme>
60((filepath "/foo.txt") (filename "foo.txt") (content-type text/plain))
61</enscript>
62
63
64=== Example
65
66<enscript highlight=scheme>
67(use send-grid)
68
69(api-user "api-user")
70(api-key "api-key")
71
72(send-mail from: "example.from@example.org" to: "example.to@example.org" from-name: "Example Name" reply-to: "example-from@example.org" subject: "Example Subject" text: "Example text.")
73</enscript>
74
75=== Version History
76
77==== Version 3.0.0
78Adding backwards compatible support for SendGrid API version 3.
79==== Version 2.0.1
80Add support for file attachments. (Thanks to Sven Hartrumpf)
81==== Version 2
82Fix some install bugs.
83==== Version 1
84Initial release.
Note: See TracBrowser for help on using the repository browser.