Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: 400 error when receiving forwarding SMS message #44

Open
oneoyz opened this issue Dec 12, 2024 · 0 comments
Open

bug: 400 error when receiving forwarding SMS message #44

oneoyz opened this issue Dec 12, 2024 · 0 comments

Comments

@oneoyz
Copy link

oneoyz commented Dec 12, 2024

I have implemented the webhook API according to the example for receiving incoming message:

    [HttpPost("api/sms/incoming-sms")]
    public IActionResult ReceiveSms([FromBody] SmsInboundMessageResult smsInboundMessageResult)
    {
        foreach (var result in smsInboundMessageResult.Results)
        {
            System.Diagnostics.Debug.WriteLine($"{result.From} - {result.CleanText}");
        }
        return Ok();
    }

and have configured the HTTP forwarding in the inbound configuration correctly. However, I failed to forward my message and the infobip support provided me the logs showing it encountered bad request error.

2024-12-10 15:12:30.098 UTC

400 Bad Request

Content-Type: application/problem+json; charset=utf-8

{"type":"https://tools.ietf.org/html/rfc9110#section-15.5.1","title":"One or more validation errors occurred.","status":400,"errors":{"incomingMessage":["The incomingMessage field is required."],"$.results[0].receivedAt":["The JSON value could not be converted to Infobip.Api.Client.Model.SmsInboundMessage. Path: $.results[0].receivedAt | LineNumber: 0 | BytePositionInLine: 169."]},"traceId":"xxxxxxxxxxxxx"}

I tested locally and found it will throw error if the receiveAt field is in 2024-12-10T15:12:28.074+0000 format instead of 2024-12-10T15:12:28.074Z, the former is the format that platform uses in forwarding message, and need to handle this situation in SmsInboundMessage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant