Advertisement
updown

Air AI Post template

Mar 7th, 2024
802
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let Timestamp = new Date().toISOString(); // creates a Timestamp
  2. let Webhook = "https://api.air.ai/v1/calls";
  3. let Method = "POST";
  4. const token = "YOUR_VALUE_HERE"
  5.  
  6. // creates the JSON Object to send with the key/value pairs
  7. const payload = {
  8.   "promptId": YOUR_NUMBER_HERE,
  9.   "phone": inputData.phoneNumber,
  10.   "name": inputData.name
  11. };
  12.  
  13.  
  14. // creates the Method, Headers, and Body of the HTTP POST Request
  15. let Options = {
  16.      method: Method,
  17.      headers: {
  18.           'Content-Type': "application/json",
  19.           "Authorization": "Bearer " + token
  20.      },
  21.      body: JSON.stringify(payload)
  22. }
  23.  
  24. const Request = await fetch(Webhook, Options); // HTTP POST Request
  25. const Response = await Request.json(); // HTTP POST Response
  26.  
  27. output = {Response, Request, Webhook, Method, Timestamp}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement