No response from php webhook

  • 1
  • Problem
  • Updated 2 weeks ago
  • (Edited)
I created a subscription in the sandbox with the following event filters:

/presence
/message-store
/message-store/instant?type=SMS

Here is the code for the WebHook php page in the subscription:
$v = $_SERVER['HTTP_VALIDATION_TOKEN'] || '';
if (strlen($v)>0) { header("Validation-Token: {$v}"); } $json_data = file_get_contents('php://input'); $fp = fopen('[path to text file]', 'a'); fwrite($fp, "Webhook event." . " " . $json_data); fclose($fp);
I would expect the webhook to be called anytime an event tied to an inbound or outbound SMS occurred.  Instead, nothing is happening.  It is not a permissions issue with the file.

Any help would be greatly appreciated.
Photo of FIELDS RESEARCH, INC.

FIELDS RESEARCH, INC.

  • 200 Points 100 badge 2x thumb
  • frustrated

Posted 2 weeks ago

  • 1
Photo of Igor Bebin

Igor Bebin, Official Rep

  • 750 Points 500 badge 2x thumb
Hi,

Small remark, Instant Message Event works only for Inbound SMS: 
https://developers.ringcentral.com/api-reference#Inbound-Message-Event

For Subscription with ID "d2bd9725-2604-47d6-8b46-69ceee60ad77" I can see: 
* 5 notifications successfully sent
* 3 failed attempts to send.

I can see a few different reasons for failed attempts - one is negative response from your WebHook Server, i.e. HTTP 500 Internal Server Error. Another is ConnectTimeoutException. 

Could you confirm that at least some of Inbound SMS events successfully reach your  WebHook? Also, make sure WebHook responds with HTTP 200 and within 3 seconds. 

Thanks,
Igor
I agree about the Instant Message event, which is why the subscription also includes Message Store.  This should allow real time notifications for inbound and outbound SMS, correct?

The WebHook is responding with HTTP 200 almost instantly.   It is definitely working since I was able to make the subscription.  If the page was broken, or somehow misconfigured, thenwouldn't the subscription attempt fail when it checked the webhook URL?

How can I confirm the inbound SMS are reaching the Webhook?  Isn't that something triggered from the RingCentral side?
(Edited)
I think I worked out the issue on our side.  The webhook is now showing results for inbound SMS responding to the original SMS sent via php.   I would like to use the same webhook to send a push notification when the original SMS is sent.  Is that possible?  
Photo of Tyler Long

Tyler Long, Official Rep

  • 8,492 Points 5k badge 2x thumb
What was the issue?  

I would like to use the same webhook to send a push notification when the original SMS is sent.  Is that possible?  
Don't quite understand. So you want to track outbound messages? Yes, I think /message-store will notice you of such events.
A security issue on our side prevented the webhook page from writing to a txt file.  Thank you for your help.