How to use webhook ?

edited April 2018 in Developers
Hi their,

I've tried to use webhooks to send SMS with twilio to present the Alphanumeric ID instead of a mobile number that doesn't erally exist.
I'm able to send correctly a SMS with webhook but not dynamicly. In other hands I am not able to retreive the data that where posted by checkfront backend.

Could you please just help to read data in PHP posted by checkfront ?

I've tried XML, JSON and x-form...

so my last code is :
<?
$startdate= $_GET["start_date"];
$sku = $_GET["sku"];
$status = $_GET["status"];
$textSMS= $startdate . "-" . $sku . "-" .$status;


require_once 'vendor/autoload.php';
$sid = "bla bla"; // Your Account SID from www.twilio.com/console
$token = "blabla"; // Your Auth Token from www.twilio.com/console

$client = new Twilio\Rest\Client($sid, $token);
$message = $client->messages->create(
  'field to get from checkfront', // Text this number
  array(
    'MessagingServiceSid' => "bla bla", // From a valid Twilio number
    'body' => $textSMS));

print $message->sid;

?>

If I specify my mobile number I receive : "---"...

thank you for helping.
Florent.

Comments

  • Hello,

    Thank you for using our forums!

    In order to correctly access the data in the response, it may help to see how it is actually formatted. You could try using the developer console to see the full response of your query. 

    To access the console, go to Manage > Developer > Console. Try typing in a query, such as 'booking/{booking_ID}' (where '{booking_ID}' is the ID of one of your bookings).

    Doing this will let you see how the response is formatted and therefore, how to access the data. For example, most of the information you need will be in the 'booking' array. So, your code should look more like this:

    $startdate = $_GET["booking"]["start_date"];

    I hope this helps and let me know if you have any more questions!

    All the best,
    Chase - Checkfront Support Team
Sign In or Register to comment.