PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, November 19, 2022

[FIXED] How to find relation between send and received message in twillio

 November 19, 2022     twilio, twilio-php     No comments   

Issue

I am using Copilot API of twillio to send sms. so i am able to send sms to end user. Now if user reply to that sms, i am receiving the callback (PHP Script). Using that callback URL, i am able to get the reply message.

Now i want to do is, i am trying to find a relation between sent and received(which end user reply) message. so i can then forward the reply message to their sender.

I will have UI like below, where user enter the message and number where he wants to receive reply.

But the problem is i am not able to find relation between send/receive message.

Any advice will be helpful.

enter image description here


Solution

Twilio developer evangelist here.

Other than storing the information on your server upon sending/receiving a message, you could make use of the cookies stored at Twilio.

When Twilio makes a request to your server and it returns a cookie (a Set-Cookie HTTP response header), Twilio stores this cookie and associates it with the From and To numbers for the incoming call or SMS message.

A little caveat to this is the fact that this cookie is only stored for four hours, so unless that works for you, I'd suggest using the from & the to as composite keys to find a relation.

Hope this helps you



Answered By - Marcos Placona
Answer Checked By - Senaida (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing