twilio-haskell icon indicating copy to clipboard operation
twilio-haskell copied to clipboard

UnexepctedResponse when sending a WhatsApp message

Open saurabhnanda opened this issue 2 years ago • 1 comments
trafficstars

Might be related to #38 . Also to debug this I had to change the constructor of UnexpectedResponse to UnexpectedResponse !String !(Response LBS.ByteString), which might be a good idea anyway.

Error

Error in $['price_unit']: mzero

Response received from the API

{
  "body": "Your Twilio code is 23975274",
  "num_segments": "1",
  "direction": "outbound-api",
  "from": "whatsapp:+141552xxxxx",
  "date_updated": "Tue, 21 Mar 2023 17:21:05 +0000",
  "price": null,
  "error_message": null,
  "uri": "/whatever.json",
  "account_sid": "REDACED",
  "num_media": "0",
  "to": "whatsapp:+91xxxxxxxxxx",
  "date_created": "Tue, 21 Mar 2023 17:21:05 +0000",
  "status": "queued",
  "sid": "REDACTED",
  "date_sent": null,
  "messaging_service_sid": null,
  "error_code": null,
  "price_unit": null,
  "api_version": "2010-04-01",
  "subresource_uris": {
    "media": "/Whatever"
  }
}

saurabhnanda avatar Mar 21 '23 17:03 saurabhnanda

In Twilio's official documentation the example shows that price and price_unit can be null. Shall I raise a PR making both these fields nullable? I can see that price was there but was commented out in the code.

saurabhnanda avatar Mar 21 '23 17:03 saurabhnanda