2121 except you.
2222 </p >
2323 <p >
24- The way it works is that you set up an encryption key which you use to
25- encrypt your messages before making an API request to httpSMS and you
26- also use the same key to decrypt the messages you receive from httpSMS
27- via our
28- <a href =" https://docs.httpsms.com/webhooks/introduction"
24+ You setup an encryption key which you use to encrypt your messages
25+ before making an API request to httpSMS and you also use the same key
26+ to decrypt the messages you receive from httpSMS via our
27+ <a
28+ class =" text-decoration-none"
29+ href =" https://docs.httpsms.com/webhooks/introduction"
2930 >webhook events</a
3031 >. We are using the
31- <a href =" https://en.wikipedia.org/wiki/Advanced_Encryption_Standard"
32+ <a
33+ class =" text-decoration-none"
34+ href =" https://en.wikipedia.org/wiki/Advanced_Encryption_Standard"
3235 >AES 265</a
3336 >
3437 encryption algorithm to encrypt and decrypt the messages.
7376 initialization vector and encoding the payload yourself.
7477 </p >
7578 <v-tabs v-model =" selectedTab" show-arrows >
79+ <v-tab href =" #javascript" >
80+ <v-icon color =" #efd81d" class =" mr-1" >{{
81+ mdiLanguageJavascript
82+ }}</v-icon >
83+ Javascript
84+ </v-tab >
7685 <v-tab href =" #go" >
77- <v-icon color =" #efd81d " class =" mr-1" >{{ mdiLanguageGo }}</v-icon >
86+ <v-icon color =" #00aed8 " class =" mr-1" >{{ mdiLanguageGo }}</v-icon >
7887 Go
7988 </v-tab >
8089 </v-tabs >
8190 <v-tabs-items v-model =" selectedTab" >
91+ <v-tab-item value =" javascript" >
92+ <pre v-highlight class =" javascript w-full mb-n12" >
93+ <code >import HttpSms from "httpsms"
94+
95+ const client = new HttpSms("" /* API Key from https://httpsms.com/settings */);
96+
97+ const key = "Password123";
98+
99+ const encryptedMessage = client.cipher.encrypt(key, "This is a sample text message");
100+
101+ // The encrypted message looks like this, note that you will get a different encrypted message when you run this code on your computer
102+ // Qk3XGN5+Ax38Ig01m4AqaP6Y0b0wYpCXtx59sU23uVLWUU/c7axF7LozDg==
103+ </code >
104+ </pre >
105+ </v-tab-item >
82106 <v-tab-item value =" go" >
83107 <pre v-highlight class =" go w-full mb-n12" >
84108<code >import "github.com/NdoleStudio/httpsms-go"
85109
86- client := htpsms.New(htpsms.WithAPIKey(/* API Key from https://httpsms.com/settings */))
110+ client := htpsms.New(htpsms.WithAPIKey("" /* API Key from https://httpsms.com/settings */))
87111
88112key := "Password123" // use the same key on the Android app
89113encryptedMessage := client.Cipher.Encrypt(key, "This is a test text message")
90114
91- // The encrypted message looks like this
115+ // The encrypted message looks like this, note that you will get a different encrypted message when you run this code on your computer
92116// Qk3XGN5+Ax38Ig01m4AqaP6Y0b0wYpCXtx59sU23uVLWUU/c7axF7LozDg==
93117</code >
94118 </pre >
@@ -103,12 +127,33 @@ encryptedMessage := client.Cipher.Encrypt(key, "This is a test text message")
103127 the Android app before sending to your recipient.
104128 </p >
105129 <v-tabs v-model =" selectedTab" show-arrows >
130+ <v-tab href =" #javascript" >
131+ <v-icon color =" #efd81d" class =" mr-1" >{{
132+ mdiLanguageJavascript
133+ }}</v-icon >
134+ Javascript
135+ </v-tab >
106136 <v-tab href =" #go" >
107- <v-icon color =" #efd81d " class =" mr-1" >{{ mdiLanguageGo }}</v-icon >
137+ <v-icon color =" #00aed8 " class =" mr-1" >{{ mdiLanguageGo }}</v-icon >
108138 Go
109139 </v-tab >
110140 </v-tabs >
111141 <v-tabs-items v-model =" selectedTab" >
142+ <v-tab-item value =" javascript" >
143+ <pre v-highlight class =" javascript w-full mb-n12" >
144+ <code >import HttpSms from "httpsms"
145+
146+ client.messages.postSend({
147+ content: encryptedMessage,
148+ from: '+18005550199',
149+ encrypted: true,
150+ to: '+18005550100',
151+ })
152+ .then((message) => {
153+ console.log(message.id); // log the ID of the sent message
154+ });</code >
155+ </pre >
156+ </v-tab-item >
112157 <v-tab-item value =" go" >
113158 <pre v-highlight class =" go w-full mb-n12" >
114159<code >import "github.com/NdoleStudio/httpsms-go"
@@ -149,12 +194,54 @@ client.Messages.Send(context.Background(), &httpsms.MessageSendParams{
149194 >
150195 </p >
151196 <v-tabs v-model =" selectedTab" show-arrows >
197+ <v-tab href =" #javascript" >
198+ <v-icon color =" #efd81d" class =" mr-1" >{{
199+ mdiLanguageJavascript
200+ }}</v-icon >
201+ Javascript
202+ </v-tab >
152203 <v-tab href =" #go" >
153- <v-icon color =" #efd81d " class =" mr-1" >{{ mdiLanguageGo }}</v-icon >
204+ <v-icon color =" #00aed8 " class =" mr-1" >{{ mdiLanguageGo }}</v-icon >
154205 Go
155206 </v-tab >
156207 </v-tabs >
157208 <v-tabs-items v-model =" selectedTab" >
209+ <v-tab-item value =" javascript" >
210+ <pre v-highlight class =" javascript w-full mb-n12" >
211+ <code >import HttpSms from "httpsms"
212+
213+ const client = new HttpSms("" /* API Key from https://httpsms.com/settings */);
214+
215+ // The payload in the webhook HTTP request looks like this
216+ /*
217+ {
218+ "specversion": "1.0",
219+ "id": "8dca3b0a-446a-4a5d-8d2a-95314926c4ed",
220+ "source": "/v1/messages/receive",
221+ "type": "message.phone.received",
222+ "datacontenttype": "application/json",
223+ "time": "2024-01-21T12:27:29.1605708Z",
224+ "data": {
225+ "message_id": "0681b838-4157-44bb-a4ea-721e40ee7ca7",
226+ "user_id": "XtABz6zdeFMoBLoltz6SREDvRSh2",
227+ "owner": "+37253920216",
228+ "encrypted": true,
229+ "contact": "+37253920216",
230+ "timestamp": "2024-01-21T12:27:17.949Z",
231+ "content": "bdmZ7n6JVf/ST+SoNlSaOGUL1DcL5705ETw8GAB4llYBgE9HOOL+Pu/h+w==",
232+ "sim": "SIM1"
233+ }
234+ }
235+ */
236+
237+ const encryptedMessage = "bdmZ7n6JVf/ST+SoNlSaOGUL1DcL5705ETw8GAB4llYBgE9HOOL+Pu/h+w==" // get the encrypted message from the request payload
238+ const encryptionkey = "Password123" // use the same key on the Android app
239+ const decryptedMessage = client.cipher.decrypt(encryptionkey, encryptedMessage)
240+
241+ // This is a test text message
242+ </code >
243+ </pre >
244+ </v-tab-item >
158245 <v-tab-item value =" go" >
159246 <pre v-highlight class =" go w-full mb-n12" >
160247<code >import "github.com/NdoleStudio/httpsms-go"
@@ -184,8 +271,8 @@ client := htpsms.New(htpsms.WithAPIKey(/* API Key from https://httpsms.com/setti
184271*/
185272
186273encryptedMessage = "bdmZ7n6JVf/ST+SoNlSaOGUL1DcL5705ETw8GAB4llYBgE9HOOL+Pu/h+w==" // get the encrypted message from the request payload
187- key := "Password123" // use the same key on the Android app
188- decryptedMessage := client.Cipher.Decrypt(key , encryptedMessage)
274+ encryptionkey := "Password123" // use the same key on the Android app
275+ decryptedMessage := client.Cipher.Decrypt(encryptionkey , encryptedMessage)
189276
190277// This is a test text message
191278</code >
@@ -213,15 +300,16 @@ decryptedMessage := client.Cipher.Decrypt(key, encryptedMessage)
213300</template >
214301
215302<script lang="ts">
216- import { mdiLanguageGo , mdiTwitter } from ' @mdi/js'
303+ import { mdiLanguageGo , mdiTwitter , mdiLanguageJavascript } from ' @mdi/js'
217304export default {
218305 name: ' EndToEndEncryptionToSmsMessages' ,
219306 layout: ' website' ,
220307 data() {
221308 return {
222309 mdiTwitter ,
223310 mdiLanguageGo ,
224- selectedTab: ' go' ,
311+ mdiLanguageJavascript ,
312+ selectedTab: ' javascript' ,
225313 authorImage: require (' @/assets/img/arnold.png' ),
226314 authorName: ' Acho Arnold' ,
227315 postDate: ' January 21, 2024' ,
@@ -244,7 +332,7 @@ export default {
244332 hid: ' og:description' ,
245333 property: ' og:description' ,
246334 content:
247- ' Configure your Android phone as an SMS gateway to automate sending text messages with the Python programing language .' ,
335+ ' We have added support for end-to-end encryption for SMS messages so that no one can see the content of the messages you send using httpSMS except you .' ,
248336 },
249337 ],
250338 }
0 commit comments