question

fax12879 avatar image
fax12879 asked fax12879 answered

No response from php webhook

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.

sdk
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

igor-bebin avatar image
igor-bebin answered
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
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

fax12879 avatar image
fax12879 answered
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?
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

fax12879 avatar image
fax12879 answered Tyler Liu commented
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?  
1 comment
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Tyler Liu avatar image Tyler Liu ♦ commented ·
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.
0 Likes 0 ·
fax12879 avatar image
fax12879 answered
A security issue on our side prevented the webhook page from writing to a txt file.  Thank you for your help.
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Developer sandbox tools

Using the RingCentral Phone for Desktop, you can dial or receive test calls, send and receive test SMS or Fax messages in your sandbox environment.

Download RingCentral Phone for Desktop:

Tip: switch to the "sandbox mode" before logging in the app:

  • On MacOS: press "fn + command + f2" keys
  • On Windows: press "Ctrl + F2" keys