Interface AnswerBotProvider



  • public interface AnswerBotProvider
          import zendesk.answerbot.AnswerBotProvider;
          ...
          AnswerBotProvider provider = AnswerBot.INSTANCE.provider();
          ...
     

    Once you have an instance of the provider you can call methods on it and handle the results in ZendeskCallback. ZendeskCallback#onSuccess(Object) will give you the deflections in the case of #getDeflectionForQuery(String, ZendeskCallback), and a Void in the case of #resolveWithArticle(long, long, String, ZendeskCallback) and #rejectWithArticle(long, long, String, RejectionReason, ZendeskCallback). ZendeskCallback#onError(ErrorResponse) will be called if there was an issue with the method call and it will provide details about the error in an com.zendesk.service.ErrorResponse

    For example, you can get the DeflectionResponse which contains a list of DeflectionArticles to present to the user for a given query.

       provider.getDeflectionForQuery(query, new ZendeskCallback <DeflectionResponse>() {
            @Override
           public void onSuccess(DeflectionResponse categories) {
               // Handle the successful query
           }
    
            @Override
           public void onError(ErrorResponse errorResponse) {
               // Handle the error
           }
       });
     
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method and Description
      void getDeflectionForQuery(java.lang.String query, <any> callback)
      Gets a DeflectionResponse for the given query String.
      void rejectWithArticle(long deflectionId, long articleId, java.lang.String interactionAccessToken, RejectionReason rejectionReason, <any> callback)
      Marks a deflection article as unhelpful and indicates that it did not resolve the user's issue
      void resolveWithArticle(long deflectionId, long articleId, java.lang.String interactionAccessToken, <any> callback)
      Marks a DeflectionArticle as helpful and indicates that the article successfully resolved the user's issue.
    • Method Detail

      • getDeflectionForQuery

        void getDeflectionForQuery(java.lang.String query,
                                   <any> callback)
        Gets a DeflectionResponse for the given query String. The DeflectionResponse contains a list of DeflectionArticles that match the query. The list is empty if no articles matched the query, and a maximum of 3 articles can be returned.
        Parameters:
        query - the query sent to Answer Bot
        callback - Callback that will deliver a DeflectionResponse
      • resolveWithArticle

        void resolveWithArticle(long deflectionId,
                                long articleId,
                                java.lang.String interactionAccessToken,
                                <any> callback)
        Marks a DeflectionArticle as helpful and indicates that the article successfully resolved the user's issue.
        Parameters:
        deflectionId - the deflectionId from Deflection.getId().
        articleId - the id of the article the user selected as helpful, DeflectionArticle.getArticleId().
        interactionAccessToken - the access token returned from DeflectionResponse.getInteractionAccessToken()
        callback - Callback that will return success or error
      • rejectWithArticle

        void rejectWithArticle(long deflectionId,
                               long articleId,
                               java.lang.String interactionAccessToken,
                               RejectionReason rejectionReason,
                               <any> callback)
        Marks a deflection article as unhelpful and indicates that it did not resolve the user's issue
        Parameters:
        deflectionId - the deflectionId from Deflection.getId().
        articleId - the id of the article the user selected as helpful, DeflectionArticle.getArticleId().
        interactionAccessToken - the access token returned from DeflectionResponse.getInteractionAccessToken()
        callback - Callback that will return success or error