A while I asked if there was any way to integrate results from the Zendesk Answer bot into ChatFuel which aside from using Zapier there didn't seem to be a method to do so. Naturally, not happy with this, I decided to write one and thought I would share the results with the community.
The prerequisites of this are that you have a ChatFuel account and you want users to be able to search your Knowledgebase and use suggestions from the Answerbot.
Create an API Client
Now it's simple enough to use the Answer Bot API to pass requests to and have a JSON response returned but this response won't work with ChatFuel as the JSON structure needs to fit with the Facebook messaging response so we need to tweak it somewhat. The way to do this is to create a middle-man to pass the search request to from ChatFuel and return the correct JSON response.
I've used Node.js hosted on a Glitch project to handle this process and you can see the code here: https://glitch.com/edit/#!/aware-flash-gouda?path=routes.js:25:67
Before you start making any changes to the code you will want to remix the project first or everyone else will see your credentials!
You don't need to use Glitch, in fact for production environments you shouldn't, but it does give you a handy platform to develop against. The setup steps are very simple:
- Remix the project first so your changes cannot be seen by anyone else. This includes your credentials!!
- Open the file routes.js and at the top enter your Zendesk domain, user and API token
- Make a note of the full URL for your glitch project. The example project URL will be https://aware-flash-gouda.glitch.me/answerbot?searchreq=
Now head over to your ChatFuel account to finish this off.
The first step is to prep your ChatFul bot to collect the search request from users. This is by far the simplest part as you are collecting a variable and passing it to the API endpoint that you created above.
- Add a new Block for your ChatFuel bot
- Create a Save User Input element with a message for the user to prompt them to enter a search term
- Save the search term to an attribute such as zendesk_answerbot_term
- Add a new JSON API element
- Set the type to GET and enter your API URL along with the variable you created
And that's it, you're done! Now when users hit your ChatFuel block they can enter a term and it will be returned from the Answer Bot. The next step for me is to extend this and add solved buttons, I might also display the results in a Webview but at least this gives you a step in the right direction.
Hope this helps!
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.