Messaging-API v1: Leitfaden für Anwendungsfälle
Informieren Sie Käufer über ihre Bestellungen
Was ist die Messaging-API?
The Selling Partner API for Messaging (Messaging API) allows you to create applications that enable sellers to send messages to buyers after they place an order. Sellers can send a variety of message types. These include asking order related questions, arranging a delivery, and more. The Messaging API can send messages to a buyer, even if the buyer has not contacted the seller first. However, you cannot use this API to respond to messages from buyers.
Refer to the Messaging API reference for a list of operations that correspond to the available message types.
Terminologie
Amazon S3 presigned URL: A URL for an Amazon S3 bucket to which you can upload an object without AWS security credentials or permissions. You get an Amazon S3 presigned URL in Step 7. Create an upload destination.
Verfügbarkeit von Nachrichten
Nicht alle Nachrichtentypen sind unter allen Umständen verfügbar. Es gibt eine Reihe von Faktoren, die sich auf die Verfügbarkeit von Nachrichten auswirken können, z. B. ob die Bestellung ausgeführt wurde, die Art des Verkäufers oder die Anzahl der für die Bestellung bereits gesendeten Nachrichten.
Workflow für das Senden einer Nachricht
Das Folgende ist für den Benutzer der Anwendung. Das Senden einer Nachricht ist ein mehrstufiger Prozess, der Aufrufe von Vorgängen sowohl in der Messaging-API als auch in der Uploads-API umfasst. Hier ist der grundlegende Arbeitsablauf für das Senden einer Nachricht:
-
In Ihrer App werden die letzten Bestellungen des Verkäufers angezeigt und der Verkäufer wählt eine Bestellung aus, für die
er eine Nachricht an den Käufer senden möchten. -
Your application displays the message types that are available for the order that the seller chooses. Get the available message types by calling the
getMessagingActionsForOrder
operation of the Messaging API. -
Der Verkäufer wählt einen Nachrichtentyp für die Bestellung.
-
Wenn benutzerdefinierte Nachrichten für den Nachrichtentyp unterstützt werden, gibt der Verkäufer eine benutzerdefinierte Nachricht ein.
-
Wenn Anhänge für den Nachrichtentyp unterstützt werden, lädt der Verkäufer einen Anhang in Ihre App hoch. Der Verkäufer gibt auch einen Dateinamen für den Anhang ein.
-
Wenn der Verkäufer einen Anhang in Ihre App hochlädt, lädt Ihre App den Anhang wie folgt in einen Amazon S3-Bucket hoch:
-
Berechnung eines Content-MD5-Hashs für den Anhang, der für die Erstellung eines Upload-Ziels benötigt wird.
-
Erstellen eines Upload-Ziels durch Aufrufen des
createUploadDestination
-Vorgangs der Uploads-API. -
Der Anhang wird an das Ziel hochgeladen.
-
-
Ihre Anwendung verlangt, dass eine Nachricht vom Verkäufer an den Käufer gesendet wird, indem der Vorgang aufgerufen wird, der dem Nachrichtentyp entspricht, den der Verkäufer in Schritt #3 ausgewählt hat. Ihre Anwendung ruft beispielsweise den
createConfirmOrderDetails
Vorgang, wenn der Verkäufer den Nachrichtentyp „Bestelldetails bestätigen“ gewählt hat. -
Amazon emails a message from the seller to the buyer. Refer to Tutorial: Send a message for the detailed workflow.
Tutorial: Eine Nachricht senden
In diesem Tutorial erfahren Sie, wie Sie eine App erstellen, mit der ein Verkäufer eine Nachricht an einen Käufer senden kann.
Voraussetzungen
Um dieses Tutorial abzuschließen, benötigen Sie:
-
Authorization from the seller for whom you are making calls. Refer to Authorizing Selling Partner API applications for more information.
-
Buyer Communication role approval in your developer profile.
-
The Buyer Communication role selected in the App registration page for your application.
Schritt 1. Die Bestellung abrufen, für die der Verkäufer eine Nachricht senden möchte
-
Zeigt eine Liste der letzten Bestellungen des Verkäufers an, aus denen der Verkäufer wählen kann.
-
Der Verkäufer wählt eine Bestellung aus, für die er eine Nachricht an den Käufer senden möchte.
-
Ordnen Sie der Bestellung, die der Verkäufer auswählt, eine Amazon-Bestellnummer zu.
-
Save the Amazon order identifier for Step 2. Get a list of available message types.
Schritt 2. Eine Liste der verfügbaren Nachrichtentypen abrufen
Call the getMessagingActionsForOrder
operation of the Messaging API, specifying the Amazon order identifier from
Step 1. Get the order for which the seller wants to send a message to get a list of message types that are available for the order.
- Call the
getMessagingActionsForOrder
operation of the Messaging API, passing the following parameters:
Pfadparameter:
Parameter | Beschreibung | Erforderlich |
---|---|---|
amazonOrderId
|
An Amazon order identifier. This specifies the order for which a message is to be sent. Get this value from Step 1. Get the order for which the seller wants to send a message.
Typ: Zeichenfolge |
Ja |
Abfrageparameter:
Parameter | Beschreibung | Erforderlich |
---|---|---|
marketplaceIds
|
Eine Marktplatz-ID. Diese gibt den Online-Marktplatz an, bei dem die Bestellung aufgegeben wurde. Sie können nur einen Online-Marktplatz angeben. Typ: Array [Zeichenfolge] |
Ja |
Beispiel anfordern
GET https://sellingpartnerapi-na.amazon.com/messaging/v1/orders/902-6786204-8179805?marketplaceIds=ATVPDKIKX0DER
Antwort
Das Antwortschema für den getMessagingActionsForOrder
Vorgang.
Name | Beschreibung | Schema |
---|---|---|
_links optional | Ein Objekt, dessen Eigenschaftsnamen Linkbeziehungstypen sind und dessen Werte entweder ein Link-Objekt oder ein Array von Link-Objekten sind. Die Betreffressource dieser Links ist das Ressourcenobjekt, dessen Eigenschaft das Objekt "_links" ist, in dem es sich um ein Objekt handelt. | _links |
_embedded optional | Ein Objekt, dessen Eigenschaftsnamen Linkbeziehungstypen und Werte sind, ist entweder ein Ressourcenobjekt oder ein Array von Ressourcenobjekten. Bei eingebetteten Ressourcen kann es sich um eine vollständige, teilweise oder inkonsistente Version der Darstellung handeln, die über den Ziel-URI bereitgestellt wird. | _embedded |
errors optional | Eine Liste von Fehlerantworten, die zurückgegeben werden, wenn eine Anfrage nicht erfolgreich ist. | ErrorList |
_links
Name | Beschreibung | Schema |
---|---|---|
self required | Entspricht der von der IANA registrierten "self" -Beziehung, deren Ziel der URI der Ressource ist. | LinkObject |
actions required | Zulässige Aktionen für die angegebene amazonOrderId. | < LinkObject > array |
Name | Schema |
---|---|
actions required | < GetMessagingActionResponse > array |
Beispiel für eine Antwort
{
"_links":
{
"actions": [
{
"href": "/messaging/v1/orders/902-6786204-
8179805/messages/confirmCustomizationDetails?marketplaceIds=ATVPDKIKX0
DER",
"name": "confirmCustomizationDetails"
},
{
"href": "/messaging/v1/orders/902-6786204-
8179805/messages/negativeFeedbackRemoval?marketplaceIds=ATVPDKIKX0DER"
,
"name": "negativeFeedbackRemoval"
},
{
"href": "/messaging/v1/orders/902-6786204-
8179805/messages/confirmOrderDetails?marketplaceIds=ATVPDKIKX0DER",
"name": "confirmOrderDetails"
},
],
"self":
{
"href": "/messaging/v1/orders/902-6786204-
8179805?marketplaceIds=ATVPDKIKX0DER"
}
},
"_embedded":
{
"actions": [
{
"_links":
{
"schema":
{
"href": "/messaging/v1/orders/902-6786204-8179805/messages/confirmCustomizationDetails/schema",
"name": "confirmCustomizationDetails"
},
"self":
{
"href": "/messaging/v1/orders/902-6786204-8179805/messages/confirmCustomizationDetails?marketplaceIds=ATVPDKIKX0DER",
"name": "confirmCustomizationDetails"
}
},
"_embedded":
{
"schema":
{
"_links":
{
"self":
{
"href": "/messaging/v1/orders/902-6786204-8179805/messages/confirmCustomizationDetails/schema",
"name": "confirmCustomizationDetails"
}
},
"type": "object",
"name": "confirmCustomizationDetails",
"title": "Confirm customization details",
"description": "Ask your customer to provide details or verify the customization input provided (name spelling, imagery, initials).",
"properties":
{
"attachments":
{
"type": "array",
"items":
{
"type": "object",
"required": [],
"properties":
{
"fileName":
{
"type": "string"
},
"id":
{
"type": "string"
}
}
},
"title": "Add attachment",
"description": "You can upload text files, PDFs, Word documents, and these image file types: .jpg, .gif, and .png. The total size of attachments must be less than 10 MB.",
"x-ui-field-type": "attachments",
"maxItems": 5
},
"rawMessageBody":
{
"type": "string",
"title": "Explain why you are contacting and any action you need your customer to take. ",
"description": "800 character limit. Only links related to order completion are allowed, no HTML or email addresses.",
"x-ui-field-type": "text",
"minLength": 1,
"maxLength": 800
}
},
"required": [
"attachments",
"rawMessageBody"
],
"$schema": "http://json-schema.org/draft-04/schema#",
"x-ui-hidden": null
}
},
"name": "confirmCustomizationDetails",
"title": "Confirm customization details"
},
{
"_links":
{
"schema":
{
"href": "/messaging/v1/orders/902-6786204-8179805/messages/negativeFeedbackRemoval/schema",
"name": "negativeFeedbackRemoval"
},
"self":
{
"href": "/messaging/v1/orders/902-6786204-8179805/messages/negativeFeedbackRemoval?marketplaceIds=ATVPDKIKX0DER",
"name": "negativeFeedbackRemoval"
}
},
"_embedded":
{
"schema":
{
"_links":
{
"self":
{
"href": "/messaging/v1/orders/902-6786204-8179805/messages/negativeFeedbackRemoval/schema",
"name": "negativeFeedbackRemoval"
}
},
"type": "object",
"name": "negativeFeedbackRemoval",
"title": "Request to update negative feedback",
"description": "Ask your customer to consider updating their seller feedback rating. You may only send this once per order.",
"properties": {},
"required": [],
"$schema": "http://json-schema.org/draft-04/schema#",
"x-ui-hidden": true
}
},
"name": "negativeFeedbackRemoval",
"title": "Request to update negative feedback"
},
{
"_links":
{
"schema":
{
"href": "/messaging/v1/orders/902-6786204-8179805/messages/confirmOrderDetails/schema",
"name": "confirmOrderDetails"
},
"self":
{
"href": "/messaging/v1/orders/902-6786204-8179805/messages/confirmOrderDetails?marketplaceIds=ATVPDKIKX0DER",
"name": "confirmOrderDetails"
}
},
"_embedded":
{
"schema":
{
"_links":
{
"self":
{
"href": "/messaging/v1/orders/902-6786204-8179805/messages/confirmOrderDetails/schema",
"name": "confirmOrderDetails"
}
},
"type": "object",
"name": "confirmOrderDetails",
"title": "Confirm order details",
"description": "Ask your customer a specific order-related question prior to shipping their order.",
"properties":
{
"rawMessageBody":
{
"type": "string",
"title": "Explain why you are contacting and any action you need your customer to take. ",
"description": "2000 character limit. Only links related to order completion are allowed, no HTML or email addresses.",
"x-ui-field-type": "text",
"minLength": 1,
"maxLength": 2000
}
},
"required": [
"rawMessageBody"
],
"$schema": "http://json-schema.org/draft-04/schema#",
"x-ui-hidden": null
}
},
"name": "confirmOrderDetails",
"title": "Confirm order details"
},
]
}
}
-
Save the list of schemas in the
_embedded.actions
array of the response. In the_embedded.schema
section of each array element you can find a schema for each available message type. Use thetitle
value in each schema to create a list of available message types for the seller to choose from in Step 3. Get the seller's choice of message type. Use the schemas to understand how to display and enforce the restrictions for custom messages and attachments that apply for each message type. For more information, refer to Step 4. Get custom message text from the seller (if supported) and Step 5. Get an attachment from the seller (if supported). -
Save the list of paths in the
_links.actions
array of the response. Thehref
value in each array element contains a path for each available message type. You can use one of these paths in a call for the appropriate operation in Step 9. Send a message to the buyer.
Schritt 3. Die Wahl des Nachrichtentyps durch den Verkäufer abrufen
-
Display a list of available message types for the seller to choose from. Get these from the
title
values that you saved in Step 2. Get a list of available message types. -
Lassen Sie den Verkäufer den Nachrichtentyp auswählen, den er gesendet haben möchte, und speichern Sie ihn. Diese Auswahl wirkt sich auf mehrere nachfolgende Schritte aus, darunter:
-
Step 4. Get custom message text from the seller (if supported). The choice of message type determines whether a custom message is supported.
-
Step 5. Get an attachment from the seller (if supported). The choice of message type determines whether attachments are supported.
-
Step 9. Send a message to the buyer. The choice of message type determines which operation you will call in Step 9. For example if the seller chooses the "Confirm customization details" message type, you will call the
confirmCustomizationDetails
operation in Step 9.
-
Schritt 4. Einen benutzerdefinierten Nachrichtentext vom Verkäufer erhalten (falls unterstützt)
Bei einigen Nachrichtentypen kann der Verkäufer der E-Mail an den Käufer eine benutzerdefinierte Nachricht hinzufügen. Um herauszufinden, ob ein Nachrichtentyp benutzerdefinierte Nachrichten unterstützt, lesen Sie in der Referenz zur Messaging-API nach, welcher Vorgang dem Nachrichtentyp entspricht. Zum Beispiel entspricht der createConfirmServiceDetails
-Vorgang dem Nachrichtentyp "Home Service-Kunden kontaktieren". Wenn der Vorgang einen Textkörperparameter enthält, unterstützt der Nachrichtentyp benutzerdefinierte Nachrichten.
-
Determine if the message type that the seller chose in Step 3. Get the seller's choice of message type supports custom messages. If custom messages are not supported, go directly to Step 5. Get an attachment from the seller (if supported). If custom messages are supported, continue with this procedure.
-
Lassen Sie den Verkäufer den Rohtext eingeben, den er für seine benutzerdefinierte Nachricht benötigt.
-
Display and enforce any restrictions on the message text that the seller inputs. You can find the text restrictions in the
_embedded.schema.properties.rawMessageBody
section of the_embedded.actions
array element that corresponds to the seller's message type. Find this in the response for thegetMessagingActionsForOrder
operation in Step 2. Get a list of available message types. -
Save the message text and use it as input for Step 9. Send a message to the buyer.
Schritt 5. Einen Anhang vom Verkäufer erhalten (falls unterstützt)
Bei einigen Nachrichtentypen kann der Verkäufer der E-Mail an den Käufer einen Link zu einem Anhang hinzufügen. Um herauszufinden, ob ein Nachrichtentyp Anlagen unterstützt, lesen Sie in der Referenz zur Nachrichten-API nach, welcher Vorgang dem Nachrichtentyp entspricht. Der Vorgang createWarranty
entspricht z. B. dem Nachrichtentyp "Garantieinformationen senden". Wenn der Vorgang einen Textparameter für Anlagen enthält, unterstützt der Nachrichtentyp Anlagen.
-
Determine if the message type that the seller chose in Step 3. Get the seller's choice of message type supports attachments. If attachments are not supported, go directly to Step 9. Send a message to the buyer. If attachments are supported, continue with this procedure.
-
Lassen Sie den Verkäufer einen Anhang zu Ihrer App hochladen.
-
Display and enforce any restrictions on the attachment that the seller uploads. You can find the attachment restrictions in the
_embedded.schema.properties.attachments
section of the_embedded.actions
array element that corresponds to the seller's message type. Find this in the response for thegetMessagingActionsForOrder
operation in Step 2. Get a list of available message types. -
Convert the attachment into an input stream and save it for Step 8. Upload the attachment.
-
Lassen Sie den Verkäufer einen Dateinamen für den Anhang eingeben, einschließlich der Dateierweiterung.
-
Save the file name and use it as input for Step 9. Send a message to the buyer.
Schritt 6. Einen Inhalt-MD5-Hash berechnen
Calculate a Content-MD5 hash for the attachment from Step 5. Get an attachment from the seller(if supported). You will need it to create an upload destination in Step 7. Create an upload destination.
Der Java-Beispielcode in diesem Schritt enthält Logik zur Berechnung eines Content-MD5-Hashs. Dieser Beispielcode verwendet den Apache HTTP-Client.
- Verwenden Sie Folgendes als Eingabe für den Beispielcode:
The attachment input stream from Step 5. Get an attachment from the seller (if supported), is the argument for the fis
parameter of the computeContentMD5Value
method of the CreateMD5
class.
- Save the
md5Content
value to pass in with theContent-MD5
parameter in Step 7. Create an upload destination.
Beispiel für Java-Code
package io.swagger.client.util;
import java.io.FileInputStream;
import java.io.IOException;
import java.security.DigestInputStream;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class CreateMD5
{
public static String computeContentMD5Value(FileInputStream fis)
throws IOException,
NoSuchAlgorithmException
{
DigestInputStream dis = new DigestInputStream(fis,
MessageDigest.getInstance("MD5"));
byte[]buffer = new byte[8192];
while (dis.read(buffer) > 0);
String md5Content = new String(org.apache.commons.codec.binary.Base64
.encodeBase64(dis.getMessageDigest().digest()));
// Effectively resets the stream to be beginning of the file
// via a FileChannel.
fis.getChannel().position(0);
return md5Content;
}
}
Schritt 7. Ein Upload-Ziel erstellen
Call the createUploadDestination
operation of the Uploads API to create an upload destination for your attachment, in the form of an Amazon S3 presigned URL. For definitions, refer to Terminology.
- Call the
createUploadDestination
operation of the Uploads API, passing the following parameters:
Abfrageparameter:
Type | Name | Beschreibung | Schema |
---|---|---|---|
Query | marketplaceIds required | Eine Liste von Marktplatz-Identifikatoren. Dies gibt die Marktplätze an, auf denen der Upload verfügbar sein wird. Es kann nur ein Marketplace angegeben werden. Maximale Anzahl : 1 | < Schnur > Reihe |
Query | Inhalt MD5 required | The Content-MD5 hash that you calculated in Step 6. Calculate a Content MD5 hash. | string |
Path | Ressource required | Die Ressource für das Upload-Ziel, das Sie erstellen. Wenn Sie beispielsweise ein Upload-Ziel für den Vorgang createLegalDisclosure der Messaging-API erstellen, wird {resource} wäre /messaging/v1/orders/{amazonOrderId}/messages/legalDisclosure , und der gesamte Pfad wäre /uploads/2020-11-01/uploadDestinations/messaging/v1/orders/{amazonOrderId}/messages/legalDisclosure . Wenn Sie ein Upload-Ziel für ein Aplus-Inhaltsdokument erstellen, wird {resource} wäre aplus/2020-11-01/contentDocuments und der Weg wäre /uploads/v1/uploadDestinations/aplus/2020-11-01/contentDocuments . | string |
Query | Inhaltstyp optional | Der Inhaltstyp der hochzuladenden Datei. | string |
Beispiel anfordern
POST https://sellingpartnerapi-na.amazon.com/uploads/2020-11-01/uploadDestinations/messaging/v1/orders/7XX-5XXXXX-8XXXXXX/messages/invoice?marketplaceIds=A2Q3Y263D00KWC&contentMD5=qCcR3o%2BU0FUR1%2BgXhApNfQ%3D%3D
Antwort
Das Antwortschema für den createUploadDestination
Vorgang.
Name | Beschreibung | Schema |
---|---|---|
payload optional | Informationen über ein Upload-Ziel. | UploadDestination |
errors optional | Eine Liste von Fehlerantworten, die zurückgegeben werden, wenn eine Anfrage nicht erfolgreich ist. | ErrorList |
Beispiel für eine Antwort
{
"payload":
{
"uploadDestinationId": "sc/7ae2d3b1-fdd3-42c4-98c4-9cc509fb95d8.png",
"url": "https://aplus-media.s3.amazonaws.com/?x-amz-date=20201116T184623Z&x-amz-signature=c5c8efd95d883b6787a2b1a93c7c066f01cb4e8d7be3ece4360aa800332e0cf9&x-amz-meta-owner=A2CZ04NGKYDXDV&acl=private&key=sc/7ae2d3b1-fdd3-42c4-98c4-9cc509fb95d8.png&x-amz-algorithm=AWS4-HMAC-SHA256&policy=eyJjb25kaXRpb25zIjpbeyJidWNrZXQiOiJhcGx1cy1tZWRpYS1iZXRhIn0seyJrZXkiOiJzb3RhLzdhZTJkM2IxLWZkZDMtNDJjNC05OGM0LTljYzUwOWZiOTVkOC5wbmcifSx7ImFjbCI6InByaXZhdGUifSx7IngtYW16LW1ldGEtb3duZXIiOiJBMkNaMDROR0tZRFhEViJ9LHsieC1hbXotYWxnb3JpdGhtIjoiQVdTNC1ITUFDLVNIQTI1NiJ9LHsieC1hbXotY3JlZGVudGlhbCI6IkFLSUE2TDZSN1FFNTZGNkdNRzVFLzIwMjAxMTE2L3VzLWVhc3QtMS9zMy9hd3M0X3JlcXVlc3QifSx7IngtYW16LWRhdGUiOiIyMDIwMTExNlQxODQ2MjNaIn0sWyJjb250ZW50LWxlbmd0aC1yYW5nZSIsMSwzMTQ1NzI4XV0sImV4cGlyYXRpb24iOiIyMDIwLTExLTE2VDIxOjQ2OjIzLjg2OFoifQ==&x-amz-credential=AKIA6L6R7QE56F6GMG5E/20201116/us-east-1/s3/aws4_request",
"headers":
{
"Content-MD5": "1jnGuPv7xwPiat6NesKL/w=="
}
}
}
- Speichern Sie die folgenden Werte:
- url and headers. Use these values in Step 8. Upload the attachment.
uploadDestinationId
. Use this value in Step 9. Send a message to the buyer.
Schritt 8. Den Anhang hochladen
Upload to an Amazon S3 bucket the attachment that the seller uploaded to your application in Step 5. Get an attachment from the seller (if supported).
Der Java-Beispielcode in diesem Schritt enthält Logik für das Hochladen eines Anhangs. Dieser Beispielcode verwendet den Apache HTTP-Client.
Verwenden Sie Folgendes als Eingabe für den Beispielcode:
-
Use the url value that you saved in Step 7. Create an upload destination as the argument for
URL(uploadDestinationPayload.getPayload().getUrl())
in theUploadFileToDestination
class. -
Use the headers value that you saved in Step 7. Create an upload destination as input for
(Map < String, String > )uploadDestinationPayload.getPayload().getHeaders()
in theUploadFileToDestination
class. -
Use the attachment input stream that you saved in Step 4. Get custom message text from the seller (if supported) and use it as input for the
out.write()
method of theUploadFileToDestination
class.
Beispiel für Java-Code
package io.swagger.client.util;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Map;
import io.swagger.client.model.CreateUploadDestinationResponse;
public class UploadFileToDestination
{
private static String requestMethod = "PUT";
private static String contentType = "Content-Type";
private static String contentValue = "application/text";
private static URL url;
private static Map < String,
String > headers;
/* Upload file to destination using the response returned in
CreateUploadDestination. Reference https://docs.aws.amazon.com/AmazonS3/latest/dev/PresignedUrlUploadObjectJavaSDK.html)
*/
public static void uploadFileInDestination(
CreateUploadDestinationResponse uploadDestinationPayload)
throws IOException
{
url = new URL(uploadDestinationPayload.getPayload().getUrl());
headers = (Map < String, String > )uploadDestinationPayload.getPayload()
.getHeaders();
// Create the connection and use it to upload the new object using the
// pre-signed URL.
HttpURLConnection connection = (HttpURLConnection)url.openConnection();
connection.setDoOutput(true);
connection.setRequestMethod(requestMethod);
connection.setRequestProperty(contentType, contentValue);
// headers that are returned in createDestination call
for (Map.Entry < String, String > headersEntry: headers.entrySet())
{
connection.setRequestProperty(headersEntry.getKey(),
headersEntry.getValue());
}
OutputStreamWriter out = new OutputStreamWriter(
connection.getOutputStream());
out.write("Text of the file");
out.close();
// Check the HTTP response code. To complete the upload and make the
// object available,
// you must interact with the connection object in some way.
connection.getResponseCode();
System.out.println("HTTP response code: " + connection.getResponseCode()
+ connection.getResponseMessage());
connection.disconnect();
}
}
Der Anhang wird in den Amazon S3-Bucket hochgeladen.
Schritt 9. Eine Nachricht an den Käufer senden
To send a message from the seller to the buyer you need to call the operation that corresponds to the message type that the seller chose in Step 2. Get a list of available message types. For example, if the seller chose the "Confirm customization details" message type, you would call the confirmCustomizationDetails
operation. Refer to the Messaging API reference for the list of operations that are available. In this example, we will call the confirmCustomizationDetails
operation.
- Rufen Sie den Vorgang
confirmCustomizationDetails
der Messaging-API auf, um folgende Parameter zu übergeben:
Pfadparameter:
Parameter | Beschreibung | Erforderlich |
---|---|---|
amazonOrderId
|
An Amazon order identifier. This specifies the order for which a message is to be sent. Use the Amazon order identifier that you saved in Step 1. Get the order for which the seller wants to send a message.
Typ: Zeichenfolge |
Ja |
Abfrageparameter:
Parameter | Beschreibung | Erforderlich |
---|---|---|
marketplaceIds
|
Eine Marktplatz-ID. Diese gibt den Online-Marktplatz an, bei dem die Bestellung aufgegeben wurde. Sie können nur einen Online-Marktplatz angeben. Typ: Array [Zeichenfolge] |
Ja |
Körperparameter:
Parameter | Beschreibung | Erforderlich |
---|---|---|
text
|
The custom message to be included in the email to the buyer. Use the message text from Step 4. Get custom message text from the seller (if supported).
Typ: Zeichenfolge |
Ja |
attachments
|
Anlagen, die in die Nachricht an den Käufer aufgenommen werden sollen
|
Ja |
Beispiel anfordern
POST https://sellingpartnerapi-na.amazon.com/messaging/v1/orders/902-6786204-8179805/messages/confirmCustomizationDetails?marketplaceIds=ATVPDKIKX0DER
{
"text": "This is the message from the seller to the buyer that will appear in the email to the buyer.",
"attachments": [
{
"uploadDestinationId": "4370d51b-2954-445c-9f30-EXAMPLE6b9de",
"fileName": "example.txt"
}
]
}
Antwort
Es gibt keine Antwort. Stattdessen sendet Amazon die Nachricht des Verkäufers per E-Mail an den Käufer.
Vor 2 Monaten aktualisiert