forked from 16BitNarwhal/Mijiji
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.ts
More file actions
28 lines (24 loc) · 641 Bytes
/
test.ts
File metadata and controls
28 lines (24 loc) · 641 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { config } from "dotenv";
config();
const MESSAGE = "Hello from HackMIT!";
const POKE_API_KEY = process.env.POKE_API_KEY;
async function sendRequest() {
try {
const response = await fetch(
"https://poke.com/api/v1/inbound-sms/webhook",
{
method: "POST",
headers: {
Authorization: `Bearer ${POKE_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ message: MESSAGE }),
}
);
const data = await response.json();
console.log(data);
} catch (error) {
console.error("Error sending request:", error);
}
}
sendRequest();