Skip to content

Commit 7f9af8a

Browse files
authored
Make link param schemas openai-compatible (#25)
1 parent fc1b491 commit 7f9af8a

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/types/templates.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@ const campaignDataFieldsSchema = z
4949
"Campaign-level data fields available as {{field}} merge parameters during message rendering. These fields are overridden by user and event data fields of the same name."
5050
);
5151

52+
const LinkParamSchema = z.object({
53+
key: z.string().describe("Link parameter key"),
54+
value: z.string().describe("Link parameter value"),
55+
});
56+
57+
const PushActionButtonSchema = z.record(z.string(), z.any());
58+
5259
// Content fields for each template type, shared between response and param schemas
5360
const EmailContentFields = {
5461
subject: z.string().optional().describe("Subject"),
@@ -88,7 +95,7 @@ const EmailContentFields = {
8895
.optional()
8996
.describe("Google analytics utm_campaign value"),
9097
linkParams: z
91-
.array(z.any())
98+
.array(LinkParamSchema)
9299
.optional()
93100
.describe("Parameters to append to each URL in html contents"),
94101
campaignDataFields: campaignDataFieldsSchema,
@@ -102,7 +109,7 @@ const SMSContentFields = {
102109
.optional()
103110
.describe("Google analytics utm_campaign value"),
104111
linkParams: z
105-
.array(z.any())
112+
.array(LinkParamSchema)
106113
.optional()
107114
.describe("Parameters to append to each URL in contents"),
108115
trackingDomain: z.string().optional().describe("Tracking Domain"),
@@ -114,7 +121,7 @@ const PushContentFields = {
114121
title: z.string().optional().describe("Push message title"),
115122
badge: z.string().optional().describe("Badge to set for push notification"),
116123
buttons: z
117-
.array(z.any())
124+
.array(PushActionButtonSchema)
118125
.optional()
119126
.describe("Array of buttons that appear to respond to the push. Max of 3"),
120127
sound: z.string().optional().describe("Sound"),

0 commit comments

Comments
 (0)