Page 1 of 2

SMS Messaging service

Posted: Mon Jul 31, 2023 10:51 am
by rdonnay
We have been trying to use Twilio for SMS messaging and are experiencing many problem with undelivered messages.

I would like some recommendations for a SMS message service that is reliable.

Re: SMS Messaging service

Posted: Wed Aug 09, 2023 7:09 am
by bobvolz
Roger; Did you register your Twilio Messaging service with the A2P 10DLC that is required for all your purchased numbers.
I have been struggling with this as well. Twilio support is not great. I learned about it on a You Tube video.
Bob Volz

Re: SMS Messaging service

Posted: Wed Aug 09, 2023 12:35 pm
by rdonnay
Bob, actually I finally got support from Twilio that was useful. They set up a zoom meeting with Bobby Drakos and myself.
They have been inundated with support requests over this A2P stuff that went into effect on July 5.
Our problems seem to be that the authorizing personnel are overloaded and that it can take many weeks to get fully registered.

Meanwhile they informed us to use a toll free number because it doesn't require the same registration.
Voila!
Our SMS messages are going thru now.

Re: SMS Messaging service

Posted: Wed Aug 09, 2023 1:47 pm
by bobvolz
Hi Roger;
I submitted my A2P twice and got rejected. The last one I did is awaiting decision. I do have a toll free number to use but haven't used it yet.
I guess I may do that if I can't get my campaign registered.
I'd like to see your endpoint code for responses that you access via the webhook. I can then build it into my app. I tried experimenting with xb2Net webserver but can't get the hook to work.
Keep me posted.
Bob Volz

Re: SMS Messaging service

Posted: Wed Aug 09, 2023 2:11 pm
by rdonnay
I hope this helps:

Code: Select all

METHOD WebService:Twilio( cData )

LOCAL oResponse, cResponse, oParams := DataObject():new(), oSms2, i, c, ;
      cHack, cUserId := '', cUserLogin := ''

oResponse := DataObject():new()
oResponse:status := 200

oParams:body := ::getVar('BODY')
oParams:&('to') := ::getVar('TO')
oParams:from := ::getVar('FROM')
oParams:SmsSid := ::getVar('SMSSID')
oParams:MessageSid := ::getVar('MESSAGESID')
oParams:SmsStatus := ::getVar('SMSSTATUS')
oParams:NumSegments := ::getVar('NUMSEGMENTS')
oParams:NumMedia := Val(::getVar('NUMMEDIA'))

FOR i := 1 TO oParams:NumMedia
  c := 'MediaContentType' + Alltrim(Str(i-1))
  oParams:&(c) := ::getVar(c)
NEXT
FOR i := 1 TO oParams:NumMedia
  c := 'MediaUrl' + Alltrim(Str(i-1))
  oParams:&(c) := ::getVar(c)
NEXT

::ParamsSetData("Twilio", oParams )

::Write2Log('Twilio', oResponse, oParams)

cResponse := ::ResponseFormat(oResponse,::httpResponse, 'JSON' )

UseDb('DRV')
cHack := DriverHackFromPhone(oParams:from)
DRV->(dbSeek(cHack,,'DRVHACK'))

UseDb('USR')
cUserID := UserFromPhone(oParams:&('to'), @cUserLogin)

UseDb('SMS2')
oSms2 := SMS2->(DC_DbRecord():new())
SMS2->(dbGoTo(0))
SMS2->(DC_DbScatter(oSms2))
oSms2:date := Date()
oSms2:time := Time()
oSms2:body := oParams:body
oSms2:viewedby := ''
oSms2:smstelfrom := oParams:from
oSms2:smstelto := oParams:&('to')
oSms2:hack := cHack
oSms2:mednum := DRV->mednum
oSms2:shift := DRV->shift
oSms2:user_id := cUserId
oSms2:user_name := cUserLogin

FOR i := 1 TO oParams:NumMedia
  c := 'MediaType' + Alltrim(Str(i-1))
  oSms2:&(c) := ::getVar(c)
NEXT
FOR i := 1 TO oParams:NumMedia
  c := 'MediaUrl' + Alltrim(Str(i-1))
  oSms2:&(c) := ::getVar(c)
NEXT

SMS2->(DC_DbGather(oSms2,.t.))

dbCloseAll()

RETURN ''

Re: SMS Messaging service

Posted: Sat Aug 12, 2023 6:39 am
by bobvolz
Hi Roger;
I integrated the code you sent with my endpoint server running under xb2Net. I can collect and parse the json that is to be posted
to the webhook as a text response from Twilio. I'm not sure the webhook is set up right. I'm assuming it is HTTPS and not just HTTP.

I'm just curious as to how you are protecting your endpoint. Are you 'whitelisting' certain DNS name or IP's that are coming from Twilio?

Also, on your Twilio phone number screen where are you putting the webhook info. See attached .png

Mine will be something like "https://api.meadowlandsystems.com:8445/process" that Twilio would use to post the json response?

Any help would be appreciated.

Bob Volz

Re: SMS Messaging service

Posted: Sat Aug 12, 2023 9:48 am
by rdonnay
This is my configuration:
twilio1.jpg
twilio1.jpg (69.08 KiB) Viewed 2702 times

Re: SMS Messaging service

Posted: Sat Aug 12, 2023 10:37 am
by bobvolz
Hi Roger; Thanks. I see you use HTTP and not HTTPS.

Do you 'white list' anyone or do you just let anyone hit your server. I set mine up without a whitelist and got 20 'hits'
in 5 minutes from hackers and sniffers. GMDit made me whitelist ips that could talk to it.
Thanks for the info.

This should be fun.

Bob Volz

Re: SMS Messaging service

Posted: Sun Aug 13, 2023 5:58 am
by rdonnay
We had so many problems getting HTTPS to work that I gave up on it for now.

It would cause complete lockups of the application and require Windows "End Task" to shut down.

I haven't monitored traffic on this webserver, other than valid hits, so I don't know how many bots are hitting it.
This has been running for over 1 1/2 years with no problems - for now.

Re: SMS Messaging service

Posted: Sun Aug 13, 2023 10:18 am
by bobvolz
Hi Roger; Happy Sunday.

According to their documentation Twilio only uses HTTPS. If yours works under HTTP then their documentation is wrong- no surprise there.

I also noticed a large number of undelivered messages using the purchased phone numbers. I took your advice and switched to the original
toll free number but that doesn't work either. It wants a registration as well. When I try to register it I get a one word response 'Conflict'.
No reason, no nothing pointing to the problem. See attached .png

I'm pretty disappointed with them. Not sure what to try next.

Keep me posted on your progress.

Bob Volz