Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Added examples for number insight async
  • Loading branch information
dragonmantank committed Oct 23, 2019
commit d3109e71d5420ab2c1194fdfc4264a22b1fc860c
5 changes: 5 additions & 0 deletions number-insights/advanced-async-callback/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"require": {
"slim/slim": "^3.8"
}
}
318 changes: 318 additions & 0 deletions number-insights/advanced-async-callback/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions number-insights/advanced-async-callback/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php
use \Psr\Http\Message\ServerRequestInterface as Request;
use \Psr\Http\Message\ResponseInterface as Response;

require 'vendor/autoload.php';

$app = new \Slim\App;

$handler = function (Request $request, Response $response) {
$params = $request->getParsedBody();

error_log($params['status_message']);
error_log($params['country_code']);
error_log($params['current_carrier']['name']);

return $response->withStatus(204);
};

$app->post('/webhook/insights', $handler);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be /webhooks/insight to match the existing samples

$app->run();
Loading