You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can get your token from the Contiguity [dashboard](https://contiguity.co/dashboard).
29
+
> [!TIP]
30
+
> It is recommended to set the `CONTIGUITY_TOKEN` environment variable instead of hardcoding your token. The SDK will automatically read this variable if no token is provided during initialization.
31
+
32
+
You can get your token from the [Contiguity console](https://console.contiguity.com/).
25
33
26
34
## Sending your first email 📤
27
35
28
36
As long as you provided Contiguity a valid token, and provide valid inputs, sending emails will be a breeze!
29
37
30
-
To begin sending an email with an HTML body, you can define a JSON object with all the required fields.
38
+
To send an email with an HTML body:
31
39
32
40
```python
33
-
email_object = {
34
-
"to": "example@example.com",
35
-
"from": "Contiguity",
36
-
"subject": "My first email!",
37
-
"html": "<b>I sent an email using Contiguity</b>"
38
-
}
39
-
40
-
client.send.email(email_object)
41
+
client.email.send(
42
+
to="example@example.com",
43
+
from_="Contiguity",
44
+
subject="My first email!",
45
+
body_html="<b>I sent an email using Contiguity</b>",
46
+
)
41
47
```
42
48
43
-
To send an email with a text body, it's very similar. Just switch "html" to "text".
49
+
To send an email with a text body:
44
50
45
51
```python
46
-
email_object = {
47
-
"to": "example@example.com",
48
-
"from": "Contiguity",
49
-
"subject": "My first email!",
50
-
"text": "I sent an email using Contiguity"
51
-
}
52
-
53
-
client.send.email(email_object)
52
+
client.email.send(
53
+
to="example@example.com",
54
+
from_="Contiguity",
55
+
subject="My first email!",
56
+
body_text="I sent an email using Contiguity",
57
+
)
54
58
```
55
59
56
60
### Optional fields
57
61
58
-
-`replyTo` allows you set a reply-to email address.
59
-
-`cc` allows you to CC an email address
60
-
61
-
You can also fetch a local email template using `client.template.local(file)`:
-`reply_to` allows you to set a reply-to email address.
63
+
-`cc` allows you to CC email addresses.
64
+
-`bcc` allows you to BCC email addresses.
65
+
-`headers` allows you to set custom email headers.
75
66
76
67
## Sending your first text message 💬
77
68
78
69
As long as you provided Contiguity a valid token, and will provide valid inputs, sending texts will be a breeze!
79
70
80
-
To begin sending a text message, you can define a JSON object with all the required fields.
81
-
82
-
```js
83
-
text_object = {
84
-
"to":"+15555555555",
85
-
"message":"My first text using Contiguity"
86
-
}
87
-
88
-
client.send.text(text_object)
71
+
```python
72
+
client.text.send(to="+15555555555", message="My first text using Contiguity")
89
73
```
90
74
91
75
**Note**: _Contiguity expects the recipient phone number to be formatted in E.164. You can attempt to pass numbers in formats like NANP, and the SDK will try its best to convert it. If it fails, it will throw an error!_
92
76
93
77
## Sending your first OTP 🔑
94
78
95
-
Contiguity aims to make communications extremely simple and elegant. In doing so, we're providing an OTP API to send one time codes - for free (no additional charge, the text message is still billed / added to quota)
79
+
Contiguity aims to make communications extremely simple and elegant. In doing so, we're providing an OTP API to send one time codes - for free (no additional charge, the text message is still billed/added to quota)
0 commit comments