Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let Timestamp = new Date().toISOString(); // creates a Timestamp
- let Webhook = "https://api.air.ai/v1/calls";
- let Method = "POST";
- const token = "YOUR_VALUE_HERE"
- // creates the JSON Object to send with the key/value pairs
- const payload = {
- "promptId": YOUR_NUMBER_HERE,
- "phone": inputData.phoneNumber,
- "name": inputData.name
- };
- // creates the Method, Headers, and Body of the HTTP POST Request
- let Options = {
- method: Method,
- headers: {
- 'Content-Type': "application/json",
- "Authorization": "Bearer " + token
- },
- body: JSON.stringify(payload)
- }
- const Request = await fetch(Webhook, Options); // HTTP POST Request
- const Response = await Request.json(); // HTTP POST Response
- output = {Response, Request, Webhook, Method, Timestamp}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement