Skip to content

Listing conversation with only order/sort fails unless specifying a user or admin #163

@thewheat

Description

@thewheat
  • Via the API it is possible to list conversations by via a GET to the /conversations endpoint with sort or order parameters
  • If you try this via this library you get an error: a user or admin type must be supplied for a conversation query

API docs
https://developers.intercom.com/reference#section-all-conversations
image

Test
image

Reason for failture
This validation currently prevents listing by conversations

if (!params.containsKey("type")) {
throw new InvalidException("a user or admin type must be supplied for a conversation query");
}

Version info

  • intercom-java version: 2.2.11
  • Java version: 1.8.0_101

Expected behavior

List all conversations

Actual behavior

Exception and no API call made

Steps to reproduce

  1. Run code with the following code
Map<String, String> params = Maps.newHashMap();
params.put("order", "created_at");
ConversationCollection conversations = Conversation.list(params);

Logs

Exception in thread "main" io.intercom.api.InvalidException: a user or admin type must be supplied for a conversation query
	at io.intercom.api.Conversation.validateListRequest(Conversation.java:145)
	at io.intercom.api.Conversation.list(Conversation.java:45)
	at org.thewheatfield.intercom.java.example.Main.main(Main.java:55)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions