1 year ago

#165966

test-img

hresh

Salesforce Rest API {"errors":["Message MTIwNToxMTQ6MA is not valid for the client."]}

Because of the work needs, I want to push the message by calling the salesforce Rest API, refer to the official documentation link: https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/postMessageListSend.html, but an error was reported during the test. I don't understand what the messageId here is, it is obviously the id of the message.

I checked the official documentation and the message data list on Salesforce, and I don't know what the problem is with messageID. In addition, there is no relevant error message in the Salesforce forum.

This is my code:

@Test
  public void pushMessage() {
    String path = "/push/v1/messageList/MTIwNToxMTQ6MA/send";

    ETRestConnection connection = client.getRestConnection();
    String value = "{\n"
        + "    \"inclusionListIds\": [\n"
        + "        \"5de5df40-9e58-ec11-ba2c-d4f5ef424xxx\"\n"
        + "    ]\n"
        + "}";

    Response response = null;
    try {
      response = connection.post(path,value);
      System.out.println(response.getResponsePayload());
      System.out.println(response.getResponseMessage());
      System.out.println(response.getResponseCode());
    } catch (ETSdkException e) {
      e.printStackTrace();
    }
  }

The execution result is:

{"errors":["Message MTIwNToxMTQ6MA is not valid for the client."]}
Bad Request
400

java

salesforce

salesforce-service-cloud

salesforce-communities

salesforce-marketing-cloud

0 Answers

Your Answer

Accepted video resources