Create Switchboard failed | Community
Skip to main content

Create Switchboard failed

  • July 9, 2024
  • 0 replies
  • 0 views

wei12

I followed the help documentation to create a Switchboard using the API, but encountered an error. Could you please help identify the cause of the error and provide a solution? Thank you.

Here is my subdomain: https://bluetti6422.zendesk.com/

 

Code:

ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.smooch.io");

HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
basicAuth.setUsername("int_668******");
basicAuth.setPassword("jAx***********2e8A");

SwitchboardsApi apiInstance = new SwitchboardsApi(defaultClient);
String appId = "6683ae**********";

try {
    SwitchboardResponse result = apiInstance.createSwitchboard(appId);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling SwitchboardsApi#createSwitchboard");
    System.err.println("Status code: " + e.getCode());
    System.err.println("Reason: " + e.getResponseBody());
    System.err.println("Response headers: " + e.getResponseHeaders());
    e.printStackTrace();
}

 

Error print:

Exception when calling SwitchboardsApi#createSwitchboard
Status code: 403
Reason: {"errors":[{"code":"forbidden","title":"Invalid scope"}]}
Response headers: {Transfer-Encoding=[chunked], CF-RAY=[8a07714308a47d59-LAX], Server=[cloudflare], vary=[X-HTTP-Method-Override], X-Request-ID=[8a07714308a47d59-LAX], x-frame-options=[SAMEORIGIN], Connection=[keep-alive], X-Zendesk-Zorg=[yes, yes], x-zendesk-account-subdomain=[bluetti6422], Date=[Tue, 09 Jul 2024 09:56:08 GMT], strict-transport-security=[max-age=31536000; includeSubDomains;], CF-Cache-Status=[DYNAMIC], x-content-type-options=[nosniff], x-xss-protection=[1; mode=block], etag=[W/"39-kxL3o8xbmSC+U0gm+RiaDbBqdT8"], Set-Cookie=[__cfruid=3112005b15f15096d7a9cb56fe4dfd6f984dab28-1720518968; path=/; domain=.smooch.io; HttpOnly; Secure; SameSite=None], cache-control=[private, no-cache, no-store, must-revalidate, private, no-cache, no-store, must-revalidate], Content-Type=[application/json; charset=utf-8]}
com.zendesk.sunshine_conversations_client.ApiException: {"errors":[{"code":"forbidden","title":"Invalid scope"}]}
    at com.zendesk.sunshine_conversations_client.ApiClient.invokeAPI(ApiClient.java:729)
    at com.zendesk.sunshine_conversations_client.api.SwitchboardsApi.createSwitchboard(SwitchboardsApi.java:79)
    at com.zendesk.sunshine_conversations_client.custom.Switchboard.createSwitchboard(Switchboard.java:53)
    at com.zendesk.sunshine_conversations_client.custom.Switchboard.main(Switchboard.java:12)

Process finished with exit code 0