Twilio integration help for the inexperienced. Voice. SMS. Chat

TWILIO…
Got everything working.
Ive had to start keeping a log of notes for each stage of my project.
Here’s an excert from my log today.
Not well put together at first, as they often start with concepts or thoughts on topic:

SMS…

and above
Erpnext uses the sms settings to call on your twilio account for outbound text msgs

Then twilio uses whatsapp connection to the number specified in twilio settings to send a prefilled response in twilio settings…

Note… will only get the twilio auto response of user has not setup url until setting up callback url

All tutorials i found did not have or show how to get that… and the RESTapi explanation from anyone that understands it even a little leaves the uninitiated like myself still not understanding

So, after many file path trial and errors, rereading the rest helps, rewatching… I understand a little more… but eventually trial and errored the correct rest method path for incoming calls and text…

voice

https://yoursite/api/method/twilio_integration.twilio_integration.api.twilio_incoming_call_handler

sms

https://yoursite/api/method/twilio_integration.twilio_integration.api.incoming_whatsapp_message_handler

What never made sense to me… if restapi is api/method/dotted.path.to.your.app

But, theres three levels of twilio_integration… so heres the mashup of what had me guessing my way through… noone would show the rest/method comparison to filepath… except for karani, and it was in creating a custom app, so not really comparable instance for a newbie until i had trial and errored my way to a slightly better understanding

For example:

https://yoursite/api/method/twilio_integration.twilio_integration.api.twilio_incoming_call_handler

complete path, with user:

/home/frappe/frappe-bench/apps/twilio_integration/twilio_integration/twilio_integration/api.py

Which is

frappe@fresherpnext:~/frappe-bench/apps/twilio_integration/twilio_integration/twilio_integration/api.py

So… apparently its the dotted.path AFTER in the app directory - followed the desired *kwargs function… or method… that is INSIDE that last file name
I just looked for the ‘def’ that said it was a method callback for incoming calls (actually has the words ’ this is ___ method…" beneath it)

-my understanding at this time… likely to improve in another month

As far as setup…

Sms when setup per njb’s post works even without twilio installed… but no erpnext responses, just the twilio demo msg, if other party responds to the sms

Have not found a way to receive sms and respond as with a normal sms conversation

The solution for that until come up with a better solution… frappe chat

Then i just set the whatsapp auto reply to say “Lets chat at https://…”

Worked awesome out of the box… and guest that you send to it after initial contact can even upload pictures of their requests…
note… as guests may be away when you reach back out, you just reinitiate the link by sending an sms from your sms center

Could even send that in the initial sms out msg, but might be harder to transition, or get replies.

VOICE…

works mostly… just not the rest method callback (at least for me)

And I do believe the callbacks will not work without upgrading twilio accound, cheap, just have to prove you are not gonna robocall and spam the crap out of people (seemed like it)

With twilio install and main account sid and token put into twilio settings…

In new voice call settings in erpnext, select yours or the user, twilio, then it has a auto populated dropdown to select from the twilio number that are in your twilio account

Calls worked right away… believe without any communication mediums setup as well

If other party calls back, they just get the twilio demo not setup until you set callback url

Recording even works… the first time clicked on it is the first time the Twiml app came into play… (i had created and deleted several before now)

The recording pops up a request for user id and password

Which is NOT your twilio login stuff, or your Account SID and token… its the twiml

I created another twiml app at this point… set it to MAIN… copied the sid and token into the prompt from erpnext… and recording started up… unsure, if needed main or standard

Still have to figure out what phone number that we want to go where.

And Most Importantly how to get immediate notification (ya know… like a phone ringing), when someone returns a call to that number… such as if have erpnext oben in browser, and your sitting down at pc… popup works great… but if used from the app on a phone, and the phone is closed, and maybe your outside… what then?

Your still. Logged in… but browser arent normally allowed to activate notifications with screen off… dunno… not an phone app designer… or really any app designer for that matter.

Still have to work out the sms… because that is so integral to quick non-interruptive communication for most of our customers… as with most i am sure.

Also, a note on Exotel… genuinely wanted to try… but the on page pricing is unclear, 5 months, 11 months, umm… likely worth it… But EVERY single time i called… not there… I tried several different times over several days… and the 833 number mentioned with their nifty auto response text is disconnected, and I just realised that maybe I had a country code or something incorrect… dunno.
+1833378… the rest is on their site
There were several days that i did not care what it cost… just please help me make my phone ring… but im stubborn and worked out a solution that will hopefully fit our needs.

Just trying to make things work… and I have found many answers here… I will usually spend many hours looking for info before asking…

Maybe this will help someone else.

And… maybe someone has more to share on their communication scenario solutions.

Thanks to all.

1 Like