Skip to content

Message Results API always returns an empty message_result array #463

Open

Description

@MrAutoIt

Expected behavior

When the Message Results API doses a post task results it should post the message_result array like in the example the documentation.
POST http://localhost/sms/index.php?task=result

{
    "message_result": [
        {
            "uuid": "052bf515-ef6b-f424-c4ee",
            "sent_result_code": 0,
            "sent_result_message": "SMSSync Message Sent"
            "delivered_result_code": -1,
            "delivered_result_message": ""
        }
}

Actual behavior

The message_results array always comes back empty.

{
    "message_result": []
}

Steps to reproduce the behavior

Per the documentation we are sending "message_uuids" through the GET task=result. It response to the API with something like this:

{
  "message_uuids": [
     "3a9ec5f2-6fa4-4f8b-b063-2d7e5267dd08"
  ]
}

However, the POST task=results always sends back an empty array. Like this:

{
    "message_result": []
}

Any help would be greatly appreciated. We have tried everything we can think of and are out of ideas on why the delivery report does not seem be working.

Activity

  1. rjmackay commented on Jan 25, 2017

    @rjmackay

    Its not clear. Is this the wrong data sent to your API by SMSSync? or the wrong data return by the API (Ushahidi v2 or v3) ?

  2. MrAutoIt commented on Jan 25, 2017

    @MrAutoIt
    Author

    SMSSync v3.0.5

    The wrong data is sent back by SMSSync. Or to be more clear just an empty array.

  3. damienrch commented on Jan 27, 2017

    @damienrch

    @rjmackay I have recently created a simple service to test this and run into exactly the same problem.

    Everything works up until delivery reports - creating messages, queuing, sending..

    But despite the android app receiving the correct message uuids from the GET /sync?task=result endpoint (from logs triggered by android app):

    Started GET "/api/sync?task=result" for 68.104.79.58 at 2017-01-27 22:10:44 +0000
    Completed 200 OK in 9ms

    ..triggered by console..

    curl --header "Content-Type: application/json" https://myserver.com/api/sync?task=result
    {"message_uuids":["9f2ca396-17a3-495d-b339-ea8aa4e812d6","38dfd4ba-7475-4be9-b192-48f8079dd3b9"]}

    .. it proceeds to POST an empty message_result to /sync?task=result..

    Started POST "/api/sync?task=result" for 68.104.79.58 at 2017-01-27 22:10:45 +0000
    Processing by Api::MessagesController#post as JSON
    Parameters: {"message_result"=>"[]", "task"=>"result", "message"=>{}}

    Application settings:

    Settings >> General >> SMS Delivery Report (enabled)
    Settings >> Task >> Enable Task Checking (enabled)
    Settings >> Task >> Set A Specific Time Frequency (1 minute)
    Settings >> Task >> Enable Message Results API (enabled)

  4. aoduor commented on Jan 29, 2017

    @aoduor
    Member

    @dalezak @brandonrosage flagging this as well for you to look into

  5. khilje125 commented on Apr 30, 2017

    @khilje125

    SMSSync Version 3.1.1
    I have an API all is working fine. Even Delivery reports activated on Network provider. But SMSSync always respond back an empty Json Array while getting Delivery response.
    For Example i send following In Get Request From API to SMSSync
    URL : http://mydomain.com/api/SMSAPI/SMSSyncGateway?task=result
    Response Data From API to SMSSync :

    {
    "message_uuids": [
    "8e4f72d3-1184-41f6-97cf",
    "5c4d1cc5-1397-425f-ae86",
    "9129fab1-bf1e-43ba-94b9",
    "71464086-4b4b-4b3f-8790",
    "3d5ca303-345a-435c-8ac7",
    "7dd6acd4-13fc-48c9-84e4",
    "3b8b531d-2b7d-47e8-9e48",
    "980b62a1-009c-4db6-b44d",
    "cbfdb6e3-f99c-4a25-aed0",
    "b50c402c-a03f-4ebd-a533",
    "f4820768-53af-4a2d-9a96",
    "f0af1679-9eab-4e77-9732"
    ]
    }
    

    Suppose these UUID's awaiting for Delivery report.

    But in Post Request From SMSSync to API

    Delivery Result :{
    "message_result": "[]"
    }
    
    

    Please respond me back where i doing wrong in setting. In SMSSync SMS Develiery repost is Checked.
    If any one have some solution is would be greatly Thanks full.

  6. MajorChump commented on Nov 2, 2017

    @MajorChump

    Easy one to fix. Issue is its only sending pending messages back to the API (which by this step there shouldnt be any) and failed messages because its using mMessageDataSource.fetchPendingByUuid(uuid).

    https://github.com/ushahidi/SMSSync/blob/master/smssync/src/main/java/org/addhen/smssync/data/message/ProcessMessageResult.java#L97

    Code should be something a long the lines of:

    Message message = mMessageDataSource.fetchByUuid(uuid);
    if (message.status != Message.Status.UNCONFIRMED.name()) {

    I'll open a PR if it'll get merged. This is untested at the moment will fork, compile and test unless you guys (@eyedol) can do in the next couple of hours?

  7. MajorChump commented on Nov 2, 2017

    @MajorChump

    PR above fixes the issue, tested with my production app and everything has cleaned up and marked delivered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions