Answered

If Resolution Bot doesn't know the answer, can I route the conversation to another API?

  • 4 August 2021
  • 6 replies
  • 60 views

Hi, I am trying to use the API to send the customer's question to another custom API if the resolution bot doesn't have an answer. I couldn't find anything in the docs about this. Is that possible?

icon

Best answer by Jamie G 6 August 2021, 22:07

View original

6 replies

Userlevel 1

Hey @jamie g​, this wouldn't be possible, simply because we don't expose any elements of Resolution Bot to our API. Can I ask a little more about your use case here? What's the custom API to which you'd like to route these conversations?

I found out a bit more information on this. It seems that I can probably use the conversation.user.replied webhook to listen for when a user replies then I may be able to parse out the customer's reply to Resolution Bot as well as the conversation ID. Then use the REST API to add replies to the conversation. I'm going to be sending the webhook to an external AI (based on the GPT-3 model) bot that helps answer these questions so I had to create an Intercom app by following your tutorial on how to do that with Glitch then that app sends a POST request to the external API with the conversation.user.replied data. Just the way I have it configured, I don't think I can make it reply back to the webhook within 5 seconds because I saw that is the timeout for those so I'll have to figure that out too but I get why it's set like that.

 

I tried to find an intercom app that will do this but there are none out there that even compare.

Userlevel 1

@jamie g​ I really appreciate you coming back and sharing this, as that information is going to be super useful for anyone who's considering doing the same thing as you.

 

If there's no Intercom app out there that does the job, have you considering building your own? You can find all of the resources you need to start building an app here. Apps are listed in our App Store once they've been built so that other Intercom customers can benefit!

I finally have my AI bot set up and I'm trying to accept the Intercom webhooks from conversation.user.replied but it's not providing me any output. Right now for testing, I'm having it just accept the webhook with PHP endpoint and write $_POST data to a file. It's just writing an empty string to the file so I know it's interacting with it but it's not sending any data.

Userlevel 1

Hey @jamie g​, I would recommend contacting our Support team directly about this through the Messenger in your Intercom workspace.

I did but I haven't heard back yet but I'll post the solution here for future devs. Instead of using $_POST in PHP to read the webhook data, you have to use something like this:

$data = file_get_contents('php://input', true);

I was able to grab everything that way and I just have to parse and process.

Reply