[GH-ISSUE #7] support callbacks in responses #4

Closed
opened 2026-02-28 01:22:42 +03:00 by kerem · 20 comments
Owner

Originally created by @mandric on GitHub (Jan 20, 2012).
Original GitHub issue: https://github.com/ushahidi/SMSSync/issues/7

Hello, I am interested in supporting a callback setting in the json response body for the gateway to make an additional HTTP request after it processes the payload. I'd like to allow the server to specify a callback attribute like below. I'm hoping to be able to chain some requests together:

callback: {
  url: 'http://something.com/path',
  params: {"foo":"bar"},
  method: "POST"
}

Before I embark on supporting this type of functionality I thought I would consult. Let me know if this is something you might find useful or how you might architect something like this, or if it fits.

Also it seems there is some confusion in the current callback term used within the application and docs that refer to a callback URL but it really seems more like a polling URL, or task polling. I would like to support both polling and callbacks, by callback I mean one http call that prompts another by providing a configuration similar to above in the response.

Originally created by @mandric on GitHub (Jan 20, 2012). Original GitHub issue: https://github.com/ushahidi/SMSSync/issues/7 Hello, I am interested in supporting a callback setting in the json response body for the gateway to make an additional HTTP request after it processes the payload. I'd like to allow the server to specify a callback attribute like below. I'm hoping to be able to chain some requests together: ``` json callback: { url: 'http://something.com/path', params: {"foo":"bar"}, method: "POST" } ``` Before I embark on supporting this type of functionality I thought I would consult. Let me know if this is something you might find useful or how you might architect something like this, or if it fits. Also it seems there is some confusion in the current callback term used within the application and docs that refer to a callback URL but it really seems more like a polling URL, or task polling. I would like to support both polling and callbacks, by callback I mean one http call that prompts another by providing a configuration similar to above in the response.
kerem 2026-02-28 01:22:42 +03:00
Author
Owner

@eyedol commented on GitHub (Jan 22, 2012):

You mind sharing a use case for this feature?

<!-- gh-comment-id:3602116 --> @eyedol commented on GitHub (Jan 22, 2012): You mind sharing a use case for this feature?
Author
Owner

@mandric commented on GitHub (Jan 23, 2012):

I will get back to you soon.

<!-- gh-comment-id:3608422 --> @mandric commented on GitHub (Jan 23, 2012): I will get back to you soon.
Author
Owner

@eyedol commented on GitHub (Jan 23, 2012):

Thank you mandric -- looking forward.

<!-- gh-comment-id:3610126 --> @eyedol commented on GitHub (Jan 23, 2012): Thank you mandric -- looking forward.
Author
Owner

@mandric commented on GitHub (Feb 9, 2012):

Hey again, the use case is referrals. Basically want the data in one sms message to get parsed and forwarded to another destination depending on the data inside of it. The use case is likely very specific to our needs/constraints. We are deploying on CouchDB and so there are limitations to what we can do server side with one request. We can create a record with an HTTP POST, but we can't do a join, we need to make another http request to look up a related record. So we need to send the gateway (or another process) some data about what is the next step to eventually complete a process, so we need to chain requests. There are two pieces to our stack: CouchDB and the SMS Gateway (SMSSync). So we are pushing extra process requests onto the gateway.

I'm planning to start a branch for this in my repo and see how it goes. If it's something you think is useful to the SMSSync users at large then let me know.

<!-- gh-comment-id:3894984 --> @mandric commented on GitHub (Feb 9, 2012): Hey again, the use case is referrals. Basically want the data in one sms message to get parsed and forwarded to another destination depending on the data inside of it. The use case is likely very specific to our needs/constraints. We are deploying on CouchDB and so there are limitations to what we can do server side with one request. We can create a record with an HTTP POST, but we can't do a join, we need to make another http request to look up a related record. So we need to send the gateway (or another process) some data about what is the next step to eventually complete a process, so we need to chain requests. There are two pieces to our stack: CouchDB and the SMS Gateway (SMSSync). So we are pushing extra process requests onto the gateway. I'm planning to start a branch for this in my repo and see how it goes. If it's something you think is useful to the SMSSync users at large then let me know.
Author
Owner

@mandric commented on GitHub (Feb 9, 2012):

Oops closed by mistake.

<!-- gh-comment-id:3895173 --> @mandric commented on GitHub (Feb 9, 2012): Oops closed by mistake.
Author
Owner

@eyedol commented on GitHub (Feb 11, 2012):

Yes, I think this well be really useful for most users. Could you send me a pull request when you're done with the implementation?

<!-- gh-comment-id:3923300 --> @eyedol commented on GitHub (Feb 11, 2012): Yes, I think this well be really useful for most users. Could you send me a pull request when you're done with the implementation?
Author
Owner

@mandric commented on GitHub (Feb 13, 2012):

@eyedol I have it in a branch resp-callback2 in my repo. let me know what you think, it's somewhat quick and dirty, I wasn't expecting you to want to merge it, so let me know if you like the idea and how to clean it up. I also added callback processing to the task polling requests, but still testing it a bit.

Thanks!

<!-- gh-comment-id:3942387 --> @mandric commented on GitHub (Feb 13, 2012): @eyedol I have it in a branch resp-callback2 in my repo. let me know what you think, it's somewhat quick and dirty, I wasn't expecting you to want to merge it, so let me know if you like the idea and how to clean it up. I also added callback processing to the task polling requests, but still testing it a bit. Thanks!
Author
Owner

@mandric commented on GitHub (Feb 19, 2012):

@eyedol I branched from the 1.1.9 tag because there appeared to be a bug in master that wouldn't let me get off the settings screen. Also now I'm maintaining a 1.1.9-kujua branch because we need to do a release soon with the callback support. Let me know what you think, your comments would be greatly appreciated and thanks again for providing SMSSync. https://github.com/mandric/SMSSync/pull/1/files

<!-- gh-comment-id:4039353 --> @mandric commented on GitHub (Feb 19, 2012): @eyedol I branched from the 1.1.9 tag because there appeared to be a bug in master that wouldn't let me get off the settings screen. Also now I'm maintaining a 1.1.9-kujua branch because we need to do a release soon with the callback support. Let me know what you think, your comments would be greatly appreciated and thanks again for providing SMSSync. https://github.com/mandric/SMSSync/pull/1/files
Author
Owner

@ghost commented on GitHub (Apr 17, 2012):

I would use something like this to have the phone report back to the server whether the message was sent successfully or not.

(If sending at message fails at first, will SMSSync retry later?)

<!-- gh-comment-id:5180468 --> @ghost commented on GitHub (Apr 17, 2012): I would use something like this to have the phone report back to the server whether the message was sent successfully or not. (If sending at message fails at first, will SMSSync retry later?)
Author
Owner

@ghost commented on GitHub (May 28, 2012):

I would have needed it last weekend.

  1. A message was sent to the SMSSync phone.
  2. Message was parsed on the server, and a reply constructed and marked as sent.
  3. SMSSync failed to receive the reply, so the whole thing failed silently.
    @mandric : Do you have installable apks?
<!-- gh-comment-id:5960124 --> @ghost commented on GitHub (May 28, 2012): I would have needed it last weekend. 1. A message was sent to the SMSSync phone. 2. Message was parsed on the server, and a reply constructed and marked as sent. 3. SMSSync failed to receive the reply, so the whole thing failed silently. @mandric : Do you have installable apks?
Author
Owner

@mandric commented on GitHub (May 28, 2012):

@agenttihirvinen I do see: https://medic.s3.amazonaws.com/downloads/gateway/SMSSync-kujua2-debug.apk and I maintain a fork if you have issues over here: https://github.com/mandric/SMSSync/ currently the callback features are undocumented though. But basically you send a resp body with a json object that has options and data properties to configure the next http request, similar to the nodejs request module.

<!-- gh-comment-id:5972878 --> @mandric commented on GitHub (May 28, 2012): @agenttihirvinen I do see: https://medic.s3.amazonaws.com/downloads/gateway/SMSSync-kujua2-debug.apk and I maintain a fork if you have issues over here: https://github.com/mandric/SMSSync/ currently the callback features are undocumented though. But basically you send a resp body with a json object that has `options` and `data` properties to configure the next http request, similar to the nodejs request module.
Author
Owner

@ghost commented on GitHub (May 31, 2012):

@mandric : Thanks, I'll try to find time to look into it. The apk fails to install btw on a Samsung Xcover at least.

<!-- gh-comment-id:6032650 --> @ghost commented on GitHub (May 31, 2012): @mandric : Thanks, I'll try to find time to look into it. The apk fails to install btw on a Samsung Xcover at least.
Author
Owner

@mandric commented on GitHub (May 31, 2012):

@agenttihirvinen what version of Android? Also I assume you enabled non-market apps? ps. i don't want to create too much noise here if it's not related to resolving the ticket.

<!-- gh-comment-id:6033333 --> @mandric commented on GitHub (May 31, 2012): @agenttihirvinen what version of Android? Also I assume you enabled non-market apps? ps. i don't want to create too much noise here if it's not related to resolving the ticket.
Author
Owner

@ghost commented on GitHub (Aug 21, 2012):

@mandric: I think it might have been an issue of not removing the old installation first, i.e. something to do with version numbers? Not really familiar with android development yet. =( Anyway, I'm now running a self-built instance of yesterday's state of development branch for multiple sync url support so I don't have to constantly break service or buy a new phone to use with my dev environment.

Any progress towards getting this merged?

<!-- gh-comment-id:7898629 --> @ghost commented on GitHub (Aug 21, 2012): @mandric: I think it might have been an issue of not removing the old installation first, i.e. something to do with version numbers? Not really familiar with android development yet. =( Anyway, I'm now running a self-built instance of yesterday's state of development branch for multiple sync url support so I don't have to constantly break service or buy a new phone to use with my dev environment. Any progress towards getting this merged?
Author
Owner

@eyedol commented on GitHub (Nov 6, 2012):

@mandric Did you get to implement this? I would like to look into this in the next release

<!-- gh-comment-id:10121441 --> @eyedol commented on GitHub (Nov 6, 2012): @mandric Did you get to implement this? I would like to look into this in the next release
Author
Owner

@mandric commented on GitHub (Nov 7, 2012):

Working on a port to 2.0 branch...

<!-- gh-comment-id:10159509 --> @mandric commented on GitHub (Nov 7, 2012): Working on a port to 2.0 branch...
Author
Owner

@mandric commented on GitHub (Nov 15, 2012):

Tossed up a doc for this, there's a download link in there if you want to try it. Feedback appreciated... I only implemented what I needed but it might be good enough for generic use. https://github.com/mandric/SMSSync/wiki/HTTP-Callbacks

<!-- gh-comment-id:10394117 --> @mandric commented on GitHub (Nov 15, 2012): Tossed up a doc for this, there's a download link in there if you want to try it. Feedback appreciated... I only implemented what I needed but it might be good enough for generic use. https://github.com/mandric/SMSSync/wiki/HTTP-Callbacks
Author
Owner

@eyedol commented on GitHub (Nov 15, 2012):

@mandric I'll play with this tomorrow. Keep you posted

<!-- gh-comment-id:10418989 --> @eyedol commented on GitHub (Nov 15, 2012): @mandric I'll play with this tomorrow. Keep you posted
Author
Owner

@eyedol commented on GitHub (May 23, 2014):

@mandric is this still valid. Confirm so I can close it.

<!-- gh-comment-id:43972372 --> @eyedol commented on GitHub (May 23, 2014): @mandric is this still valid. Confirm so I can close it.
Author
Owner

@mandric commented on GitHub (May 23, 2014):

No it's not valid anymore. We are going with the more straightforward documented web API for results instead, see #11.

<!-- gh-comment-id:44003796 --> @mandric commented on GitHub (May 23, 2014): No it's not valid anymore. We are going with the more straightforward documented web API for results instead, see #11.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/SMSSync#4
No description provided.