Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
166 changes: 99 additions & 67 deletions apps/docs/content/docs/en/tools/revenuecat.mdx

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions apps/sim/app/(landing)/integrations/data/integrations.json
Original file line number Diff line number Diff line change
Expand Up @@ -10748,7 +10748,7 @@
},
{
"name": "Refund Google Subscription",
"description": "Refund and optionally revoke a Google Play subscription (Google Play only)"
"description": "Refund a specific store transaction by its store transaction identifier and revoke access (subscription or non-subscription, last 365 days)"
},
{
"name": "Revoke Google Subscription",
Expand Down Expand Up @@ -14173,7 +14173,7 @@
"description": "Hire a pre-hire into an employee position. Converts an applicant into an active employee record with position, start date, and manager assignment."
},
{
"name": "Update Worker",
"name": "Update Personal Information",
"description": "Update fields on an existing worker record in Workday."
},
{
Expand Down
196 changes: 174 additions & 22 deletions apps/sim/blocks/blocks/revenuecat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export const RevenueCatBlock: BlockConfig<RevenueCatResponse> = {
{ label: 'Daily', id: 'daily' },
{ label: '3 Days', id: 'three_day' },
{ label: 'Weekly', id: 'weekly' },
{ label: '2 Weeks', id: 'two_week' },
Comment thread
waleedlatif1 marked this conversation as resolved.
{ label: 'Monthly', id: 'monthly' },
{ label: '2 Months', id: 'two_month' },
{ label: '3 Months', id: 'three_month' },
Expand All @@ -85,6 +86,28 @@ export const RevenueCatBlock: BlockConfig<RevenueCatResponse> = {
value: 'grant_entitlement',
},
},
{
id: 'endTimeMs',
title: 'End Time (ms)',
type: 'short-input',
placeholder: 'Optional absolute end time in ms since epoch',
condition: {
field: 'operation',
value: 'grant_entitlement',
},
mode: 'advanced',
wandConfig: {
enabled: true,
prompt: `Generate a Unix epoch timestamp in milliseconds based on the user's description.
The timestamp should represent the absolute end time for the entitlement.
Examples:
- "in 7 days" -> current time plus 604800000 milliseconds
- "next month" -> current time plus 2592000000 milliseconds
- "end of 2026" -> 1798761600000

Return ONLY the numeric timestamp, no text.`,
},
},
{
id: 'startTimeMs',
title: 'Start Time (ms)',
Expand Down Expand Up @@ -124,9 +147,10 @@ Return ONLY the numeric timestamp, no text.`,
},
{
id: 'productId',
title: 'Product ID',
title: 'Product ID / Store Transaction ID',
type: 'short-input',
placeholder: 'Product identifier',
placeholder:
'Product ID, or store transaction ID for refunds (e.g., GPA.3309-9122-6177-45730)',
condition: {
field: 'operation',
value: [
Expand All @@ -139,7 +163,6 @@ Return ONLY the numeric timestamp, no text.`,
required: {
field: 'operation',
value: [
'create_purchase',
'defer_google_subscription',
'refund_google_subscription',
'revoke_google_subscription',
Expand Down Expand Up @@ -168,6 +191,61 @@ Return ONLY the numeric timestamp, no text.`,
},
mode: 'advanced',
},
{
id: 'presentedOfferingIdentifier',
title: 'Presented Offering ID',
type: 'short-input',
placeholder: 'Offering identifier shown to the user',
condition: {
field: 'operation',
value: 'create_purchase',
},
mode: 'advanced',
},
{
id: 'paymentMode',
title: 'Payment Mode',
type: 'dropdown',
options: [
{ label: 'Pay As You Go', id: 'pay_as_you_go' },
{ label: 'Pay Up Front', id: 'pay_up_front' },
{ label: 'Free Trial', id: 'free_trial' },
],
condition: {
field: 'operation',
value: 'create_purchase',
},
mode: 'advanced',
},
{
id: 'introductoryPrice',
title: 'Introductory Price',
type: 'short-input',
placeholder: 'e.g., 0.99',
condition: {
field: 'operation',
value: 'create_purchase',
},
mode: 'advanced',
},
{
id: 'updatedAtMs',
title: 'Updated At (ms)',
type: 'short-input',
placeholder: 'Unix epoch ms used to resolve attribute conflicts',
condition: {
field: 'operation',
value: 'create_purchase',
},
mode: 'advanced',
wandConfig: {
enabled: true,
prompt: `Generate a Unix epoch timestamp in milliseconds based on the user's description.
Used by RevenueCat to resolve attribute conflicts on a posted purchase.

Return ONLY the numeric timestamp, no text.`,
},
},
{
id: 'isRestore',
title: 'Is Restore',
Expand All @@ -192,13 +270,19 @@ Return ONLY the numeric timestamp, no text.`,
{ label: 'Android', id: 'android' },
{ label: 'Amazon', id: 'amazon' },
{ label: 'macOS', id: 'macos' },
{ label: 'UIKit for Mac', id: 'uikitformac' },
{ label: 'Stripe', id: 'stripe' },
{ label: 'Roku', id: 'roku' },
{ label: 'Paddle', id: 'paddle' },
],
condition: {
field: 'operation',
value: 'create_purchase',
},
mode: 'advanced',
required: {
field: 'operation',
value: 'create_purchase',
},
},
{
id: 'attributes',
Expand All @@ -207,7 +291,7 @@ Return ONLY the numeric timestamp, no text.`,
placeholder: '{"$email": {"value": "user@example.com"}}',
condition: {
field: 'operation',
value: 'update_subscriber_attributes',
value: ['update_subscriber_attributes', 'create_purchase'],
},
required: {
field: 'operation',
Expand Down Expand Up @@ -238,10 +322,24 @@ Return ONLY valid JSON.`,
field: 'operation',
value: 'defer_google_subscription',
},
required: {
},
{
id: 'expiryTimeMs',
title: 'Expiry Time (ms)',
type: 'short-input',
placeholder: 'Absolute new expiry time in ms since epoch',
condition: {
field: 'operation',
value: 'defer_google_subscription',
},
mode: 'advanced',
wandConfig: {
enabled: true,
prompt: `Generate a Unix epoch timestamp in milliseconds based on the user's description.
The timestamp should represent the new absolute expiry time of the subscription.

Return ONLY the numeric timestamp, no text.`,
},
},
{
id: 'platform',
Expand All @@ -251,13 +349,15 @@ Return ONLY valid JSON.`,
{ label: 'iOS', id: 'ios' },
{ label: 'Android', id: 'android' },
{ label: 'Amazon', id: 'amazon' },
{ label: 'macOS', id: 'macos' },
{ label: 'Stripe', id: 'stripe' },
{ label: 'Roku', id: 'roku' },
{ label: 'Paddle', id: 'paddle' },
],
condition: {
field: 'operation',
value: 'list_offerings',
},
mode: 'advanced',
},
],
tools: {
Expand All @@ -274,23 +374,42 @@ Return ONLY valid JSON.`,
'revenuecat_revoke_google_subscription',
],
config: {
tool: (params) => {
tool: (params) => `revenuecat_${params.operation}`,
params: (params) => {
const next: Record<string, unknown> = { ...params }
if (params.purchasePlatform && params.operation === 'create_purchase') {
params.platform = params.purchasePlatform
next.platform = params.purchasePlatform
}
next.purchasePlatform = undefined
if (params.productId && params.operation === 'refund_google_subscription') {
next.storeTransactionId = params.productId
next.productId = undefined
}
if (params.isRestore !== undefined) {
params.isRestore = params.isRestore === 'true'
if (params.isRestore !== undefined && params.isRestore !== '') {
next.isRestore = params.isRestore === true || params.isRestore === 'true'
}
if (params.price !== undefined && params.price !== '') {
params.price = Number(params.price)
next.price = Number(params.price)
}
if (params.extendByDays !== undefined && params.extendByDays !== '') {
params.extendByDays = Number(params.extendByDays)
next.extendByDays = Number(params.extendByDays)
}
if (params.startTimeMs !== undefined && params.startTimeMs !== '') {
params.startTimeMs = Number(params.startTimeMs)
next.startTimeMs = Number(params.startTimeMs)
}
if (params.endTimeMs !== undefined && params.endTimeMs !== '') {
next.endTimeMs = Number(params.endTimeMs)
Comment thread
cursor[bot] marked this conversation as resolved.
}
if (params.expiryTimeMs !== undefined && params.expiryTimeMs !== '') {
next.expiryTimeMs = Number(params.expiryTimeMs)
}
if (params.introductoryPrice !== undefined && params.introductoryPrice !== '') {
next.introductoryPrice = Number(params.introductoryPrice)
}
return `revenuecat_${params.operation}`
if (params.updatedAtMs !== undefined && params.updatedAtMs !== '') {
next.updatedAtMs = Number(params.updatedAtMs)
}
return next
},
},
},
Expand All @@ -302,28 +421,61 @@ Return ONLY valid JSON.`,
duration: { type: 'string', description: 'Promotional entitlement duration' },
startTimeMs: { type: 'number', description: 'Custom start time in ms since epoch' },
fetchToken: { type: 'string', description: 'Store receipt or purchase token' },
productId: { type: 'string', description: 'Product identifier' },
productId: {
type: 'string',
description: 'Product identifier (or store transaction ID for refunds)',
},
price: { type: 'number', description: 'Product price' },
currency: { type: 'string', description: 'ISO 4217 currency code' },
isRestore: { type: 'boolean', description: 'Whether this is a restore purchase' },
purchasePlatform: { type: 'string', description: 'Platform for the purchase' },
attributes: { type: 'string', description: 'JSON object of subscriber attributes' },
presentedOfferingIdentifier: {
type: 'string',
description: 'Identifier of the offering presented to the user',
},
paymentMode: {
type: 'string',
description: 'Payment mode (pay_as_you_go, pay_up_front, free_trial)',
},
attributes: {
type: 'string',
description:
'JSON object of subscriber attributes (used by update_subscriber_attributes and create_purchase)',
},
introductoryPrice: { type: 'number', description: 'Introductory price for the purchase' },
updatedAtMs: {
type: 'number',
description: 'Unix epoch ms used by RevenueCat to resolve attribute conflicts',
},
extendByDays: { type: 'number', description: 'Number of days to extend (1-365)' },
platform: { type: 'string', description: 'Platform filter for offerings' },
expiryTimeMs: { type: 'number', description: 'Absolute new expiry time in ms since epoch' },
endTimeMs: {
type: 'number',
description: 'Absolute end time for entitlement in ms since epoch',
},
platform: { type: 'string', description: 'Platform (X-Platform header)' },
},
outputs: {
subscriber: {
type: 'json',
description: 'Subscriber object with subscriptions and entitlements',
description:
'Subscriber object (first_seen, original_app_user_id, original_purchase_date, management_url, subscriptions, entitlements, non_subscriptions)',
},
offerings: {
type: 'json',
description: 'Array of offerings with packages',
description: 'Array of offerings, each with identifier, description, and packages[]',
},
current_offering_id: { type: 'string', description: 'Current offering identifier' },
metadata: { type: 'json', description: 'Operation metadata' },
metadata: {
type: 'json',
description:
'Operation metadata. For get_customer: app_user_id, first_seen, active_entitlements, active_subscriptions. For list_offerings: count, current_offering_id.',
},
deleted: { type: 'boolean', description: 'Whether the subscriber was deleted' },
app_user_id: { type: 'string', description: 'The app user ID' },
updated: { type: 'boolean', description: 'Whether the attributes were updated' },
customer: {
type: 'json',
description: 'Customer object returned by create_purchase (when present in the response)',
},
},
}
Loading
Loading