Twilio sms session between multiple website user pairs using app's twilio number -
i want start , end session website multiple users can start sms session website , send message mobile numbers using site's twilio number. receiver can reply message , sender user sms on website. want keep conversation record both parties.
please suggest best possible solution.
twilio evangelist here.
we call anonymous communications , easy achieve. have 2 different ways of approaching it:
when sends sms twilio number, respond twilio empty twiml:
<response></response>
then, use helper library in preferred language make api call twilio send message counter-party. ruby helper library, (remember change parameters described):
require 'twilio-ruby' client = twilio::rest::client.new "my-twilio-sid", "my-twilio_token" client.account.messages.create to: "counter-party-number", from: "twilio-number", body: "message-body"
if ruby isn't thing, have libraries in php, python, c#, java , node. plus bunch more our community.
then counter-party received sms, , replies. need use from
number (the number of person sending message) figure out send - original user - looking session in database.
the same thing can achieved using twiml. when create twiml response incoming sms, need identify message should sent to, before. produce twiml using attributes on <message>
verb (i'll use php time):
<response> <message to="<?php echo $message_to; ?>" from="<?php echo $twilio_number; "> <?php echo $message_body ?> </message> </response>
that send message on counter party, don't need make api call.
hope helps!
Comments
Post a Comment