BOD-14 Baseline server-side send,receive,status APIs created
This commit is contained in:
@@ -54,7 +54,10 @@ export function ChatConversationComponent({
|
|||||||
}}
|
}}
|
||||||
size='small'>
|
size='small'>
|
||||||
{conversation.open ? (
|
{conversation.open ? (
|
||||||
<ChatConversationOpenComponent messages={messages} />
|
<ChatConversationOpenComponent
|
||||||
|
messages={messages}
|
||||||
|
conversation={conversation}
|
||||||
|
/>
|
||||||
) : (
|
) : (
|
||||||
<ChatConversationClosedComponent conversation={conversation} />
|
<ChatConversationClosedComponent conversation={conversation} />
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -16,14 +16,13 @@ const mapDispatchToProps = dispatch => ({
|
|||||||
function ChatSendMessageComponent({ conversation, bodyshop, sendMessage }) {
|
function ChatSendMessageComponent({ conversation, bodyshop, sendMessage }) {
|
||||||
const [message, setMessage] = useState("");
|
const [message, setMessage] = useState("");
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
console.log("message", message);
|
|
||||||
|
|
||||||
const handleEnter = () => {
|
const handleEnter = () => {
|
||||||
console.log("Sending that message ");
|
|
||||||
sendMessage({
|
sendMessage({
|
||||||
to: conversation.phone,
|
to: conversation.phone,
|
||||||
body: message,
|
body: message,
|
||||||
messagingServiceSid: bodyshop.messagingservicesid
|
messagingServiceSid: bodyshop.messagingservicesid,
|
||||||
|
conversationid: conversation.id
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ import axios from "axios";
|
|||||||
export function* onSendMessage() {
|
export function* onSendMessage() {
|
||||||
yield takeLatest(MessagingActionTypes.SEND_MESSAGE, sendMessage);
|
yield takeLatest(MessagingActionTypes.SEND_MESSAGE, sendMessage);
|
||||||
}
|
}
|
||||||
export function* sendMessage(payload) {
|
export function* sendMessage({ payload }) {
|
||||||
|
console.log("In the saga.");
|
||||||
try {
|
try {
|
||||||
console.log("Message Contents", payload);
|
console.log("Message Contents", payload);
|
||||||
axios.post("/sms/send", payload).then(response => {
|
axios.post("/sms/send", payload).then(response => {
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
- args:
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: messages
|
||||||
|
schema: public
|
||||||
|
type: drop_insert_permission
|
||||||
|
- args:
|
||||||
|
permission:
|
||||||
|
check:
|
||||||
|
conversation:
|
||||||
|
bodyshop:
|
||||||
|
associations:
|
||||||
|
_and:
|
||||||
|
- user:
|
||||||
|
authid:
|
||||||
|
_eq: X-Hasura-User-Id
|
||||||
|
- active:
|
||||||
|
_eq: true
|
||||||
|
columns:
|
||||||
|
- id
|
||||||
|
- created_at
|
||||||
|
- updated_at
|
||||||
|
- msid
|
||||||
|
- conversationid
|
||||||
|
- text
|
||||||
|
- image
|
||||||
|
- image_path
|
||||||
|
- sent
|
||||||
|
- delivered
|
||||||
|
- isoutbound
|
||||||
|
localPresets:
|
||||||
|
- key: ""
|
||||||
|
value: ""
|
||||||
|
set: {}
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: messages
|
||||||
|
schema: public
|
||||||
|
type: create_insert_permission
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
- args:
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: messages
|
||||||
|
schema: public
|
||||||
|
type: drop_insert_permission
|
||||||
|
- args:
|
||||||
|
permission:
|
||||||
|
check:
|
||||||
|
conversation:
|
||||||
|
bodyshop:
|
||||||
|
associations:
|
||||||
|
_and:
|
||||||
|
- user:
|
||||||
|
authid:
|
||||||
|
_eq: X-Hasura-User-Id
|
||||||
|
- active:
|
||||||
|
_eq: true
|
||||||
|
columns:
|
||||||
|
- conversationid
|
||||||
|
- created_at
|
||||||
|
- id
|
||||||
|
- image
|
||||||
|
- image_path
|
||||||
|
- isoutbound
|
||||||
|
- msid
|
||||||
|
- text
|
||||||
|
- updated_at
|
||||||
|
localPresets:
|
||||||
|
- key: ""
|
||||||
|
value: ""
|
||||||
|
set: {}
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: messages
|
||||||
|
schema: public
|
||||||
|
type: create_insert_permission
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
- args:
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: messages
|
||||||
|
schema: public
|
||||||
|
type: drop_select_permission
|
||||||
|
- args:
|
||||||
|
permission:
|
||||||
|
allow_aggregations: false
|
||||||
|
columns:
|
||||||
|
- delivered
|
||||||
|
- image
|
||||||
|
- isoutbound
|
||||||
|
- sent
|
||||||
|
- image_path
|
||||||
|
- msid
|
||||||
|
- text
|
||||||
|
- created_at
|
||||||
|
- updated_at
|
||||||
|
- conversationid
|
||||||
|
- id
|
||||||
|
computed_fields: []
|
||||||
|
filter:
|
||||||
|
conversation:
|
||||||
|
bodyshop:
|
||||||
|
associations:
|
||||||
|
_and:
|
||||||
|
- user:
|
||||||
|
authid:
|
||||||
|
_eq: X-Hasura-User-Id
|
||||||
|
- active:
|
||||||
|
_eq: true
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: messages
|
||||||
|
schema: public
|
||||||
|
type: create_select_permission
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
- args:
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: messages
|
||||||
|
schema: public
|
||||||
|
type: drop_select_permission
|
||||||
|
- args:
|
||||||
|
permission:
|
||||||
|
allow_aggregations: false
|
||||||
|
columns:
|
||||||
|
- conversationid
|
||||||
|
- created_at
|
||||||
|
- id
|
||||||
|
- image
|
||||||
|
- image_path
|
||||||
|
- isoutbound
|
||||||
|
- msid
|
||||||
|
- text
|
||||||
|
- updated_at
|
||||||
|
computed_fields: []
|
||||||
|
filter:
|
||||||
|
conversation:
|
||||||
|
bodyshop:
|
||||||
|
associations:
|
||||||
|
_and:
|
||||||
|
- user:
|
||||||
|
authid:
|
||||||
|
_eq: X-Hasura-User-Id
|
||||||
|
- active:
|
||||||
|
_eq: true
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: messages
|
||||||
|
schema: public
|
||||||
|
type: create_select_permission
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
- args:
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: messages
|
||||||
|
schema: public
|
||||||
|
type: drop_update_permission
|
||||||
|
- args:
|
||||||
|
permission:
|
||||||
|
columns:
|
||||||
|
- delivered
|
||||||
|
- image
|
||||||
|
- isoutbound
|
||||||
|
- sent
|
||||||
|
- image_path
|
||||||
|
- msid
|
||||||
|
- text
|
||||||
|
- created_at
|
||||||
|
- updated_at
|
||||||
|
- conversationid
|
||||||
|
- id
|
||||||
|
filter:
|
||||||
|
conversation:
|
||||||
|
bodyshop:
|
||||||
|
associations:
|
||||||
|
_and:
|
||||||
|
- user:
|
||||||
|
authid:
|
||||||
|
_eq: X-Hasura-User-Id
|
||||||
|
- active:
|
||||||
|
_eq: true
|
||||||
|
localPresets:
|
||||||
|
- key: ""
|
||||||
|
value: ""
|
||||||
|
set: {}
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: messages
|
||||||
|
schema: public
|
||||||
|
type: create_update_permission
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
- args:
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: messages
|
||||||
|
schema: public
|
||||||
|
type: drop_update_permission
|
||||||
|
- args:
|
||||||
|
permission:
|
||||||
|
columns:
|
||||||
|
- conversationid
|
||||||
|
- created_at
|
||||||
|
- id
|
||||||
|
- image
|
||||||
|
- image_path
|
||||||
|
- isoutbound
|
||||||
|
- msid
|
||||||
|
- text
|
||||||
|
- updated_at
|
||||||
|
filter:
|
||||||
|
conversation:
|
||||||
|
bodyshop:
|
||||||
|
associations:
|
||||||
|
_and:
|
||||||
|
- user:
|
||||||
|
authid:
|
||||||
|
_eq: X-Hasura-User-Id
|
||||||
|
- active:
|
||||||
|
_eq: true
|
||||||
|
localPresets:
|
||||||
|
- key: ""
|
||||||
|
value: ""
|
||||||
|
set: {}
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: messages
|
||||||
|
schema: public
|
||||||
|
type: create_update_permission
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
- args:
|
||||||
|
cascade: false
|
||||||
|
read_only: false
|
||||||
|
sql: ALTER TABLE "public"."messages" ADD COLUMN "delivered" bool;
|
||||||
|
type: run_sql
|
||||||
|
- args:
|
||||||
|
cascade: false
|
||||||
|
read_only: false
|
||||||
|
sql: ALTER TABLE "public"."messages" ALTER COLUMN "delivered" DROP NOT NULL;
|
||||||
|
type: run_sql
|
||||||
|
- args:
|
||||||
|
cascade: false
|
||||||
|
read_only: false
|
||||||
|
sql: ALTER TABLE "public"."messages" ALTER COLUMN "delivered" SET DEFAULT false;
|
||||||
|
type: run_sql
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
- args:
|
||||||
|
cascade: false
|
||||||
|
read_only: false
|
||||||
|
sql: ALTER TABLE "public"."messages" DROP COLUMN "delivered" CASCADE;
|
||||||
|
type: run_sql
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
- args:
|
||||||
|
cascade: false
|
||||||
|
read_only: false
|
||||||
|
sql: ALTER TABLE "public"."messages" ADD COLUMN "sent" bool;
|
||||||
|
type: run_sql
|
||||||
|
- args:
|
||||||
|
cascade: false
|
||||||
|
read_only: false
|
||||||
|
sql: ALTER TABLE "public"."messages" ALTER COLUMN "sent" DROP NOT NULL;
|
||||||
|
type: run_sql
|
||||||
|
- args:
|
||||||
|
cascade: false
|
||||||
|
read_only: false
|
||||||
|
sql: ALTER TABLE "public"."messages" ALTER COLUMN "sent" SET DEFAULT false;
|
||||||
|
type: run_sql
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
- args:
|
||||||
|
cascade: false
|
||||||
|
read_only: false
|
||||||
|
sql: ALTER TABLE "public"."messages" DROP COLUMN "sent" CASCADE;
|
||||||
|
type: run_sql
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
- args:
|
||||||
|
cascade: false
|
||||||
|
read_only: false
|
||||||
|
sql: ALTER TABLE "public"."messages" DROP COLUMN "status";
|
||||||
|
type: run_sql
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
- args:
|
||||||
|
cascade: false
|
||||||
|
read_only: false
|
||||||
|
sql: ALTER TABLE "public"."messages" ADD COLUMN "status" text NOT NULL DEFAULT
|
||||||
|
'posted';
|
||||||
|
type: run_sql
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
- args:
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: messages
|
||||||
|
schema: public
|
||||||
|
type: drop_insert_permission
|
||||||
|
- args:
|
||||||
|
permission:
|
||||||
|
check:
|
||||||
|
conversation:
|
||||||
|
bodyshop:
|
||||||
|
associations:
|
||||||
|
_and:
|
||||||
|
- user:
|
||||||
|
authid:
|
||||||
|
_eq: X-Hasura-User-Id
|
||||||
|
- active:
|
||||||
|
_eq: true
|
||||||
|
columns:
|
||||||
|
- conversationid
|
||||||
|
- created_at
|
||||||
|
- id
|
||||||
|
- image
|
||||||
|
- image_path
|
||||||
|
- isoutbound
|
||||||
|
- msid
|
||||||
|
- text
|
||||||
|
- updated_at
|
||||||
|
localPresets:
|
||||||
|
- key: ""
|
||||||
|
value: ""
|
||||||
|
set: {}
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: messages
|
||||||
|
schema: public
|
||||||
|
type: create_insert_permission
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
- args:
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: messages
|
||||||
|
schema: public
|
||||||
|
type: drop_insert_permission
|
||||||
|
- args:
|
||||||
|
permission:
|
||||||
|
check:
|
||||||
|
conversation:
|
||||||
|
bodyshop:
|
||||||
|
associations:
|
||||||
|
_and:
|
||||||
|
- user:
|
||||||
|
authid:
|
||||||
|
_eq: X-Hasura-User-Id
|
||||||
|
- active:
|
||||||
|
_eq: true
|
||||||
|
columns:
|
||||||
|
- id
|
||||||
|
- created_at
|
||||||
|
- updated_at
|
||||||
|
- msid
|
||||||
|
- conversationid
|
||||||
|
- text
|
||||||
|
- image
|
||||||
|
- image_path
|
||||||
|
- isoutbound
|
||||||
|
- status
|
||||||
|
localPresets:
|
||||||
|
- key: ""
|
||||||
|
value: ""
|
||||||
|
set: {}
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: messages
|
||||||
|
schema: public
|
||||||
|
type: create_insert_permission
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
- args:
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: messages
|
||||||
|
schema: public
|
||||||
|
type: drop_select_permission
|
||||||
|
- args:
|
||||||
|
permission:
|
||||||
|
allow_aggregations: false
|
||||||
|
columns:
|
||||||
|
- conversationid
|
||||||
|
- created_at
|
||||||
|
- id
|
||||||
|
- image
|
||||||
|
- image_path
|
||||||
|
- isoutbound
|
||||||
|
- msid
|
||||||
|
- text
|
||||||
|
- updated_at
|
||||||
|
computed_fields: []
|
||||||
|
filter:
|
||||||
|
conversation:
|
||||||
|
bodyshop:
|
||||||
|
associations:
|
||||||
|
_and:
|
||||||
|
- user:
|
||||||
|
authid:
|
||||||
|
_eq: X-Hasura-User-Id
|
||||||
|
- active:
|
||||||
|
_eq: true
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: messages
|
||||||
|
schema: public
|
||||||
|
type: create_select_permission
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
- args:
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: messages
|
||||||
|
schema: public
|
||||||
|
type: drop_select_permission
|
||||||
|
- args:
|
||||||
|
permission:
|
||||||
|
allow_aggregations: false
|
||||||
|
columns:
|
||||||
|
- conversationid
|
||||||
|
- created_at
|
||||||
|
- id
|
||||||
|
- image
|
||||||
|
- image_path
|
||||||
|
- isoutbound
|
||||||
|
- msid
|
||||||
|
- status
|
||||||
|
- text
|
||||||
|
- updated_at
|
||||||
|
computed_fields: []
|
||||||
|
filter:
|
||||||
|
conversation:
|
||||||
|
bodyshop:
|
||||||
|
associations:
|
||||||
|
_and:
|
||||||
|
- user:
|
||||||
|
authid:
|
||||||
|
_eq: X-Hasura-User-Id
|
||||||
|
- active:
|
||||||
|
_eq: true
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: messages
|
||||||
|
schema: public
|
||||||
|
type: create_select_permission
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
- args:
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: messages
|
||||||
|
schema: public
|
||||||
|
type: drop_update_permission
|
||||||
|
- args:
|
||||||
|
permission:
|
||||||
|
columns:
|
||||||
|
- conversationid
|
||||||
|
- created_at
|
||||||
|
- id
|
||||||
|
- image
|
||||||
|
- image_path
|
||||||
|
- isoutbound
|
||||||
|
- msid
|
||||||
|
- text
|
||||||
|
- updated_at
|
||||||
|
filter:
|
||||||
|
conversation:
|
||||||
|
bodyshop:
|
||||||
|
associations:
|
||||||
|
_and:
|
||||||
|
- user:
|
||||||
|
authid:
|
||||||
|
_eq: X-Hasura-User-Id
|
||||||
|
- active:
|
||||||
|
_eq: true
|
||||||
|
localPresets:
|
||||||
|
- key: ""
|
||||||
|
value: ""
|
||||||
|
set: {}
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: messages
|
||||||
|
schema: public
|
||||||
|
type: create_update_permission
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
- args:
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: messages
|
||||||
|
schema: public
|
||||||
|
type: drop_update_permission
|
||||||
|
- args:
|
||||||
|
permission:
|
||||||
|
columns:
|
||||||
|
- image
|
||||||
|
- isoutbound
|
||||||
|
- image_path
|
||||||
|
- msid
|
||||||
|
- status
|
||||||
|
- text
|
||||||
|
- created_at
|
||||||
|
- updated_at
|
||||||
|
- conversationid
|
||||||
|
- id
|
||||||
|
filter:
|
||||||
|
conversation:
|
||||||
|
bodyshop:
|
||||||
|
associations:
|
||||||
|
_and:
|
||||||
|
- user:
|
||||||
|
authid:
|
||||||
|
_eq: X-Hasura-User-Id
|
||||||
|
- active:
|
||||||
|
_eq: true
|
||||||
|
localPresets:
|
||||||
|
- key: ""
|
||||||
|
value: ""
|
||||||
|
set: {}
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: messages
|
||||||
|
schema: public
|
||||||
|
type: create_update_permission
|
||||||
@@ -40,7 +40,11 @@ app.post(
|
|||||||
var smsSend = require("./server/sms/send");
|
var smsSend = require("./server/sms/send");
|
||||||
app.post("/sms/send", smsSend.send);
|
app.post("/sms/send", smsSend.send);
|
||||||
var smsStatus = require("./server/sms/status");
|
var smsStatus = require("./server/sms/status");
|
||||||
app.post("/sms/status", smsStatus.status);
|
app.post(
|
||||||
|
"/sms/status",
|
||||||
|
twilio.webhook({ validate: process.env.NODE_ENV === "PRODUCTION" }),
|
||||||
|
smsStatus.status
|
||||||
|
);
|
||||||
|
|
||||||
var downloadImages = require("./download-images");
|
var downloadImages = require("./download-images");
|
||||||
app.get("/downloadImages", downloadImages.downloadImages);
|
app.get("/downloadImages", downloadImages.downloadImages);
|
||||||
|
|||||||
@@ -21,3 +21,13 @@ mutation INSERT_MESSAGE($msg: [messages_insert_input!]!) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
exports.UPDATE_MESSAGE_STATUS = `
|
||||||
|
mutation UPDATE_MESSAGE($msid: String!, $fields: messages_set_input!) {
|
||||||
|
update_messages(where: { msid: { _eq: $msid } }, _set: $fields) {
|
||||||
|
returning {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|||||||
@@ -1,16 +1,24 @@
|
|||||||
require("dotenv").config();
|
require("dotenv").config();
|
||||||
const twilio = require("twilio");
|
const twilio = require("twilio");
|
||||||
const phone = require("phone");
|
const phone = require("phone");
|
||||||
|
const queries = require("../graphql-client/queries");
|
||||||
|
|
||||||
const client = twilio(
|
const client = twilio(
|
||||||
process.env.TWILIO_AUTH_TOKEN,
|
process.env.TWILIO_AUTH_TOKEN,
|
||||||
process.env.TWILIO_AUTH_KEY
|
process.env.TWILIO_AUTH_KEY
|
||||||
);
|
);
|
||||||
|
const gqlClient = require("../graphql-client/graphql-client").client;
|
||||||
|
|
||||||
exports.send = (req, res) => {
|
exports.send = (req, res) => {
|
||||||
console.log("Sending an SMS!");
|
console.log("Sending an SMS!");
|
||||||
const { to, messagingServiceSid, body, conversationid } = req.body;
|
const { to, messagingServiceSid, body, conversationid } = req.body;
|
||||||
|
console.log(
|
||||||
|
"to, messagingServiceSid, body, conversationid",
|
||||||
|
to,
|
||||||
|
messagingServiceSid,
|
||||||
|
body,
|
||||||
|
conversationid
|
||||||
|
);
|
||||||
if (!!to && !!messagingServiceSid && !!body && !!conversationid) {
|
if (!!to && !!messagingServiceSid && !!body && !!conversationid) {
|
||||||
client.messages
|
client.messages
|
||||||
.create({
|
.create({
|
||||||
@@ -25,16 +33,20 @@ exports.send = (req, res) => {
|
|||||||
conversationid,
|
conversationid,
|
||||||
isoutbound: true
|
isoutbound: true
|
||||||
};
|
};
|
||||||
client
|
gqlClient
|
||||||
.request(queries.INSERT_MESSAGE, { msg: newMessage })
|
.request(queries.INSERT_MESSAGE, { msg: newMessage })
|
||||||
.then(r2 => {
|
.then(r2 => {
|
||||||
res.sendStatus(200);
|
res.sendStatus(200);
|
||||||
})
|
})
|
||||||
.catch(e2 => {
|
.catch(e2 => {
|
||||||
res.json({ success: false, message: e2 });
|
console.log("e2", e2);
|
||||||
|
//res.json({ success: false, message: e2 });
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch(error => res.json({ success: false, message: error }));
|
.catch(e1 => {
|
||||||
|
//res.json({ success: false, message: error });
|
||||||
|
console.log("e1", e1);
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
res.json({ success: false, message: "Missing required parameter(s)." });
|
res.json({ success: false, message: "Missing required parameter(s)." });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,8 +4,18 @@ const queries = require("../graphql-client/queries");
|
|||||||
const phone = require("phone");
|
const phone = require("phone");
|
||||||
|
|
||||||
exports.status = (req, res) => {
|
exports.status = (req, res) => {
|
||||||
//Perform request validation
|
const { SmsSid, SmsStatus } = req.body;
|
||||||
console.log("Inbound Status Update: ", JSON.stringify(req.body));
|
client
|
||||||
|
.request(queries.UPDATE_MESSAGE_STATUS, {
|
||||||
|
msid: SmsSid,
|
||||||
|
fields: { status: SmsStatus }
|
||||||
|
})
|
||||||
|
.then(response => {
|
||||||
|
console.log("Message Updated");
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.log("Error updating message status", error);
|
||||||
|
});
|
||||||
res.sendStatus(200);
|
res.sendStatus(200);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user