payload-plugin-newsletter 0.9.1 → 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2088,20 +2088,18 @@ var BroadcastProvider = class {
2088
2088
  name: this.fromName
2089
2089
  };
2090
2090
  const recipients = Array.isArray(params.to) ? params.to : [params.to];
2091
- const response = await fetch(`${this.apiUrl}/api/v1/emails`, {
2091
+ const response = await fetch(`${this.apiUrl}/api/v1/transactionals.json`, {
2092
2092
  method: "POST",
2093
2093
  headers: {
2094
2094
  "Authorization": `Bearer ${this.token}`,
2095
2095
  "Content-Type": "application/json"
2096
2096
  },
2097
2097
  body: JSON.stringify({
2098
- from_email: from.email,
2099
- from_name: from.name,
2100
- to: recipients,
2098
+ to: recipients[0],
2099
+ // Broadcast API expects a single recipient for transactional emails
2101
2100
  subject: params.subject,
2102
- html_body: params.html,
2103
- text_body: params.text,
2104
- reply_to: params.replyTo
2101
+ body: params.html || params.text || "",
2102
+ reply_to: params.replyTo || from.email
2105
2103
  })
2106
2104
  });
2107
2105
  if (!response.ok) {