Seems - after a lot of Googling - that the Kannel SMS gateway actually doesn't support HTTP POST for sending SMSes, which is a limit to the size of SMSes being sent :(
On Tue, Jan 23, 2018 at 1:35 PM, Kasper Nielsen <kasp.n...@gmail.com> wrote: > Looked through the contrib-examples and all examples actually uses the > HTTP GET method to send SMS, which may fail on large SMSes. > > On Tue, Jan 23, 2018 at 12:19 PM, Kasper Nielsen <kasp.n...@gmail.com> > wrote: > >> ...and tried old school XML: >> >> var xml = ' \ >> <?xml version="1.0"?>\ >> <message>\ >> <submit>\ >> <da><number>11021034235</number></da>\ >> <oa><number>11076034723</number></oa>\ >> <ud>Hello</ud>\ >> <from>\ >> <user>foo</user>\ >> <username>foo</username>\ >> <pass>bar</pass>\ >> <password>bar</password>\ >> </from>\ >> </submit>\ >> </message>\ >> '; >> >> var options = { >> method: 'POST', >> uri: 'http://127.0.0.1:13002/cgi-bin/sendsms', >> body: xml, >> headers: {'content-type': 'text/xml'} >> }; >> >> but getting: body: 'Authorization failed for sendsms' } } >> >> >> On Tue, Jan 23, 2018 at 11:58 AM, Kasper Nielsen <kasp.n...@gmail.com> >> wrote: >> >>> Also able to get: body: 'Invalid content-type' } } >>> But the content-type is correct http form: application/x-www-form-urlenco >>> ded. >>> >>> On Tue, Jan 23, 2018 at 11:57 AM, Kasper Nielsen <kasp.n...@gmail.com> >>> wrote: >>> >>>> ...and the docs doesn't seem to tell anything about this. >>>> >>>> On Tue, Jan 23, 2018 at 11:36 AM, Kasper Nielsen <kasp.n...@gmail.com> >>>> wrote: >>>> >>>>> This is my NodeJS (request-promise) for sending SMS via HTTP GET: >>>>> >>>>> var options = { >>>>> method: 'GET', >>>>> uri: 'http://127.0.0.1:13002/cgi-bin/sendsms', >>>>> qs: { >>>>> username: 'foo', >>>>> password: 'bar', >>>>> to: '127883327304', >>>>> from: '12488331359 <(248)%20833-1359>', >>>>> text: 'Hi >>>>> } >>>>> }; >>>>> >>>>> This works, but changing to HTTP POST fails. >>>>> >>>>> var options = { >>>>> method: 'POST', >>>>> uri: 'http://127.0.0.1:13002/cgi-bin/sendsms', >>>>> form: { >>>>> username: 'foo', >>>>> password: 'bar', >>>>> to: '127883327304', >>>>> from: '12488331359 <(248)%20833-1359>', >>>>> text: 'Hi >>>>> } >>>>> }; >>>>> >>>>> Getting body: 'Authorization failed for sendsms' } } >>>>> >>>> >>>> >>> >> >