-
Notifications
You must be signed in to change notification settings - Fork 1
Debugging Fulfillment
When writing fulfillment logic sometimes it's easier to debug the logic locally rather than continuously deploying kind-of broken code to test it.
First thing you need to do is ensure you have a valid Jobber access token, these tokens expire every hour so make sure you have an up to date one. You can get an Access token using the Google Actions simulator. After launching the JobberSmartAssistant look at the "Request" tab on the right of the simulator:
Then pull the access token from the request body:
After getting a token you need to build a fulfillment request that has the required information for you endpoint. Fill in the following json with the appropriate action name, jobber token, contexts, and parameters for your specific request. If you want to simulate not having access to a screen while making the request i.e. you made the request from your Google Home rather than phone remove the actions_capability_screen_output
from the contexts list:
{
"originalRequest": {
"source": "google",
"version": "2",
"data": {
"user": {
"lastSeen": "2018-03-14T05:01:55Z",
"locale": "en-US",
"accessToken": "[INSERT_JOBBER_TOKEN_HERE]"
}
}
},
"id": "b2c137da-8caa-4f50-abc1-2f5088f3d740",
"timestamp": "2018-03-14T05:03:23.753Z",
"lang": "en-us",
"result": {
"source": "agent",
"speech": "",
"action": "[INSERT_ACTION_NAME_HERE]",
"actionIncomplete": false,
"parameters": {
"TEST_PARAMETER" : "2"
},
"contexts": [
{
"name": "actions_capability_screen_output",
"parameters": {
"amount": "7",
"amount.original": "7"
},
"lifespan": 0
}
],
}
}
Use any HttpClient to fire off a POST
request into the fulfillment service. Make sure the above json is included in your request body. If you are using the default port then the fulfillment service should be hosted on:
http://localhost:5000/fulfillment