Inserting GraphQL record from JSON payload

167 Views Asked by At

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
   }
}
0

There are 0 best solutions below