-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
created the basics skeleton of the project
- Loading branch information
0 parents
commit 9809cec
Showing
6 changed files
with
1,846 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
|
||
############### TWILIO API STARTS ########################## | ||
TwILIO_ACCOUNT_SID = AC340f3a25143d73e51194ddd63d245fd0 | ||
TWILIO_AUTH_TOKEN = 81c8d68b5e70928bb65710c358f2f1f3 | ||
############## TWILIO API ENDS ###################### | ||
|
||
|
||
NEXT_PUBLIC_GRAPHQL_URI=http://localhost:5001/graphql | ||
#NEXT_PUBLIC_GRAPHQL_URI=https://soil-api-backend-developai2.up.railway.app/graphql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import axios from "axios"; | ||
import dotenv from "dotenv"; | ||
dotenv.config(); | ||
|
||
const baseURL = process.env.NEXT_PUBLIC_GRAPHQL_URI; | ||
|
||
console.log("baseURL = ", baseURL); | ||
const apiClient = axios.create({ | ||
baseURL, | ||
method: "POST", | ||
}); | ||
|
||
apiClient.interceptors.request.use(function (config) { | ||
config.headers["Access-Control-Allow-Origin"] = "*"; | ||
return config; | ||
}, null); | ||
|
||
export default apiClient; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
const dotenv = require('dotenv'); | ||
const twilio = require('twilio'); | ||
const cors = require("cors"); | ||
const express = require('express'); | ||
const MessagingResponse = require('twilio').twiml.MessagingResponse; | ||
|
||
dotenv.config(); | ||
|
||
const accountSid = process.env.TwILIO_ACCOUNT_SID; | ||
const authToken = process.env.TWILIO_AUTH_TOKEN; | ||
const client = new twilio(accountSid, authToken); | ||
|
||
|
||
|
||
(async () => { | ||
|
||
const app = express(); | ||
const port = 3000; | ||
|
||
|
||
|
||
app.use(cors()) | ||
app.use(express.json()); | ||
app.use(express.urlencoded({ extended: false })); | ||
|
||
// const url = await ngrok.connect(4000); | ||
// console.log("server url: ", url) | ||
|
||
app.post('/incoming', (req, res) => { | ||
const message = req.body; | ||
console.log("msg ", message) | ||
|
||
const twiml = new MessagingResponse(); | ||
twiml.message(`I am busy now: `); //response message. | ||
res.writeHead(200, { 'Content-Type': 'text/xml' }); | ||
res.end(twiml.toString()); | ||
}); | ||
|
||
app.listen(port, () => { | ||
console.log(`Server running on http://localhost:${port}`); | ||
}); | ||
})(); | ||
|
||
|
||
|
||
|
||
|
||
|
Oops, something went wrong.