Open Search

Working web hook response for api.ai from WordPress

April 11, 2017 11:20 am
Categorised in:
Reading Time: 1

Just a quick response for anyone that needs a draft response to check that their web hook is working for api.ai. The response requirements for api.ai are kinda strict. But this works enough so you can get onto the interesting stuff.  Simply save the snippet as a PHP file on your server and set up your web hook within api.ai

Personally, I’ve just set this as a php file with a content header set to return Json, just a tad quicker to have myself set up for when I’ve finished  wrap it all up with in a WordPress query later.

<?php header("Content-type: application/json"); ?>
{
  "speech": "Hello I am a working response",
  "source": "apiai-weather-webhook-sample",
  "data": [],
  "displayText": "Hello I am a working response"
}

This joint was penned by @elmarko