3

[Context]

I'm trying to build connect via API to the Einstein Bot API. I carefully, followed the set up mentioned here. https://developer.salesforce.com/docs/service/einstein-bot-api/guide/get-started.html

I also used the guide written here for the connected app. With some modifications to match with the bot's permission requirements.

https://blog.deadlypenguin.com/2019/03/08/jwt-bearer-auth-salesforce-node/

I can make POST calls to the bot API and they appear to at least getting to the bot, using a token.

{
"botId": "0Xx0o000000TO*****",
"externalSessionKey": "0dc69c6e-ac09-11ec-b909-0242ac120002",
"messages": [
    {
        "sequenceId": 0,
        "type": "init",
        "text": "Hello",
        "variables": [
            {
                "name": "$Context.IntegrationName",
                "type": "text",
                "value": "Test Integration Name"
            },
            {
                "name": "$Context.IntegrationType",
                "type": "text",
                "value": "API"
            }
        ]
    }
],
"forceConfig": {
    "endpoint": "https://*****-dev-ed.my.salesforce.com"
}
}

My headers also appear correct.

[Problem]

When a POST a request to the bot I get this error:

{
"status": 403,
"path": "v4.0.0/messages",
"mode": "unknown",
"requestId": "0dc69c6e-ac09-11ec-b909-0242ac120004",
"error": "UnauthorizedException",
"message": "Unauthorized connected app",
"timestamp": 1650254642990,
"expected": true
}

I'm calling to the bot with the dev salesforce admin user. I have the following set up in the connected app.

  • OAuth Policies

  • Admin approved users are pre-authorized

  • Scopes

  • Access chatbot services (chatbot_api)

  • Perform requests at any time (refresh_token, offline_access)

The connected app's Profile and Permission Sets look like this.

permission sets

[Questions]

  • What does the error Unauthorized connected app refer to?
  • Does the error suggest that there are further permissions needed by the Connected app in order to work with the Einstein bot? If yes, what might they be?
  • Do you know of resources other than the Einstein Bot API link above that explains how to set up and use the Einstein Bot API, please (I have looked all over)?

1 Answer 1

0

In the Configuration of the Einstein Bot, you need to connect it to your Connected App. The process is described here in Step 2:

https://developer.salesforce.com/docs/service/einstein-bot-api/guide/prerequisites.html

(I think the documentation may have changed here since the point in time that you looked at it?)

If you don't do this step, you Connected app is "unauthorized" to talk to this specific bot.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .