0

I am currently follwing MEssageBird sms documentation here https://docs.messagebird.com/api/channels-api/supported-channels/programmable-sms/sending-messages

I am using restsharp and making an httppost request and I get an error from the API. Unprocessed Entity. {"code":"InvalidPayload","message":"One or more fields provided in the request body are malformed: no matching operation was found"}.

My JsonString is

{
  "receiver": {
    "contacts": [
      {
        "identifierValue": "+1XXXXXXXXXX"
      }
    ]
  },
  "body": {
    "type": "text",
    "text": {
      "text": "Single Text Message"
    }
  }
}

My json object is almost identical to the documentation.

var client = new RestClient("https://nest.messagebird.com/workspaces/XXXXXXX/channels/XXXXXXXX/messages");
var request = new RestRequest("Resources", Method.Post);
const string ApplicationJsonContentType = "application/json"; 
request.RequestFormat = RestSharp.DataFormat.Json;
request.AddHeader("Authorization", "AccessKey XXXXXXXXXXXXX");
request.AddBody(jsonString);
var response = client.Execute(request);

May I ask if anyone has any suggestions on where I may be going wrong on sending an httppost to MessageBird.

Master
  • 2,038
  • 2
  • 27
  • 77

0 Answers0