0

I’m working on building an SMS platform, so part of this is for the SMS gateway to forward the SMS to a public URL with a JSON Payload (which I have no control of the format) so I need to have it accepted by a lambda in Slash GraphQL and then from there insert it as a record in the Graph database for later processing.

The SMS gateway will send an HTTP POST with JSON payload to the lambda function.

I have deployed this type:

type InboundSMS  {
  id: String! @id
  dateTime: String!
  destinationAddress: String!
  messageId: String!
  message: String!
  resourceURL: String!
  senderAddress: String!
}

As the schema for the incoming SMS with JSON format:

HTTP POST

{
  "inboundSMSMessageList":{
      "inboundSMSMessage":[
         {
            "dateTime":"Fri Nov 22 2013 12:12:13 GMT+0000 (UTC)",
            "destinationAddress":"tel:21581234",
            "messageId":null,
            "message":"Hello",
            "resourceURL":null,
            "senderAddress":"tel:+639171234567"
         }
       ],
       "numberOfMessagesInThisBatch":1,
       "resourceURL":null,
       "totalNumberOfPendingMessages":null
   }
}
quarks
  • 33,478
  • 73
  • 290
  • 513
  • not valid request (`{query:...}`) for graphql server ... you must use other endpoint ... or middleware? – xadm Feb 08 '21 at 23:30
  • First, you give no problem you are facing... secondly your schema would not accept that input because messageId and resourceURL are null in input but non null in schema. Lastly, you will need a lambda hosted outside of dgraph to accept this JSON, strip out the inboundSMSMessage list and forward as GraphQL mutations to Dgraph. The slash graphql (now Dgraph Cloud) lambdas are not for external http posts but are intranet to your Dgraph instance. – amaster Jun 23 '21 at 04:52

0 Answers0