AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents
TypeScript ai-agentai-agent-toolsai-agentsai-agents-frameworkmcpmcp-servermcp-toolsmcpsn8n-alternativeno-code-automationworkflowworkflow-automationworkflows
feat(pushover): let agents send, escalate and manage delivery groups (#15694)
Odai Ahmadae2a50a0c427
diff --git a/packages/pieces/community/pushover/package.json b/packages/pieces/community/pushover/package.jsonindex c4bfc18feac..66e862be7b3 100644--- a/packages/pieces/community/pushover/package.json+++ b/packages/pieces/community/pushover/package.json@@ -1,6 +1,6 @@{"name": "@activepieces/piece-pushover",- "version": "0.2.8",+ "version": "0.2.9","main": "./dist/src/index.js","types": "./dist/src/index.d.ts","scripts": {diff --git a/packages/pieces/community/pushover/src/i18n/translation.json b/packages/pieces/community/pushover/src/i18n/translation.jsonindex c765d41f4ea..cefe1d56675 100644--- a/packages/pieces/community/pushover/src/i18n/translation.json+++ b/packages/pieces/community/pushover/src/i18n/translation.json@@ -6,7 +6,45 @@"Pushover User Key": "Pushover User Key","\n To obtain the api token:\n\n 1. Log in to Pushover.\n 2. Click on your Application or on Create an Application/API Token\n 3. Copy the API Token/Key.\n\n To obtain the user key:\n 1. Log in to Pushover\n 2. Copy your Your User Key\n\n Note if you want to send the message to your group, you should specify a group key instead of the user key\n ": "\n To obtain the api token:\n\n 1. Log in to Pushover.\n 2. Click on your Application or on Create an Application/API Token\n 3. Copy the API Token/Key.\n\n To obtain the user key:\n 1. Log in to Pushover\n 2. Copy your Your User Key\n\n Note if you want to send the message to your group, you should specify a group key instead of the user key\n ","Send Notification": "Send Notification",+ "Send Push Message": "Send Push Message",+ "Get Emergency Receipt Status": "Get Emergency Receipt Status",+ "Cancel Emergency Retries": "Cancel Emergency Retries",+ "Cancel Emergency Retries by Tag": "Cancel Emergency Retries by Tag",+ "Validate User or Group Key": "Validate User or Group Key",+ "Get Monthly Message Limits": "Get Monthly Message Limits",+ "Update Glance Widget": "Update Glance Widget",+ "List Delivery Groups": "List Delivery Groups",+ "Get Delivery Group": "Get Delivery Group",+ "Create Delivery Group": "Create Delivery Group",+ "Rename Delivery Group": "Rename Delivery Group",+ "Add User to Delivery Group": "Add User to Delivery Group",+ "Remove User from Delivery Group": "Remove User from Delivery Group",+ "Disable Group User": "Disable Group User",+ "Enable Group User": "Enable Group User",+ "Get License Credits": "Get License Credits",+ "Assign License": "Assign License",+ "List Notification Sounds": "List Notification Sounds",+ "Migrate User to Subscription": "Migrate User to Subscription","Send a notification to Pushover": "Send a notification to Pushover",+ "Send a push message through Pushover with the full parameter set": "Send a push message through Pushover with the full parameter set",+ "Read the acknowledgement status of an emergency notification receipt": "Read the acknowledgement status of an emergency notification receipt",+ "Stop the retry loop of one emergency notification receipt": "Stop the retry loop of one emergency notification receipt",+ "Stop the retry loops of every emergency notification carrying a tag": "Stop the retry loops of every emergency notification carrying a tag",+ "Check whether a Pushover user or group key is valid and reachable": "Check whether a Pushover user or group key is valid and reachable",+ "Read the monthly message allowance and remaining quota of the application": "Read the monthly message allowance and remaining quota of the application",+ "Update the Pushover glance widget fields on the user devices": "Update the Pushover glance widget fields on the user devices",+ "List the delivery groups owned by the Pushover account": "List the delivery groups owned by the Pushover account",+ "Read the name and members of one Pushover delivery group": "Read the name and members of one Pushover delivery group",+ "Create a Pushover delivery group, or return the existing one with that name": "Create a Pushover delivery group, or return the existing one with that name",+ "Change the name of a Pushover delivery group": "Change the name of a Pushover delivery group",+ "Add a user key as a member of a Pushover delivery group": "Add a user key as a member of a Pushover delivery group",+ "Permanently remove a member from a Pushover delivery group": "Permanently remove a member from a Pushover delivery group",+ "Temporarily stop a group member from receiving group messages": "Temporarily stop a group member from receiving group messages",+ "Resume group deliveries to a suspended group member": "Resume group deliveries to a suspended group member",+ "Read how many prepaid Pushover license credits remain": "Read how many prepaid Pushover license credits remain",+ "Spend a prepaid credit to license a Pushover user": "Spend a prepaid credit to license a Pushover user",+ "List the notification sound identifiers Pushover accepts": "List the notification sound identifiers Pushover accepts",+ "Convert an existing user key into a subscribed user key": "Convert an existing user key into a subscribed user key","Title": "Title","Message": "Message","Enable HTML": "Enable HTML",@@ -17,6 +55,28 @@"URL Title": "URL Title","Timestamp": "Timestamp","Device": "Device",+ "Time To Live": "Time To Live",+ "Sound": "Sound",+ "Monospace": "Monospace",+ "Tags": "Tags",+ "Callback URL": "Callback URL",+ "Attachment (Base64)": "Attachment (Base64)",+ "Attachment Type": "Attachment Type",+ "Receipt": "Receipt",+ "Tag": "Tag",+ "User or Group Key": "User or Group Key",+ "Text": "Text",+ "Subtext": "Subtext",+ "Count": "Count",+ "Percent": "Percent",+ "Group Key": "Group Key",+ "Name": "Name",+ "New Name": "New Name",+ "Memo": "Memo",+ "Email": "Email",+ "Operating System": "Operating System",+ "Subscription Code": "Subscription Code",+ "Device Name": "Device Name","The title of the notification": "The title of the notification","The message to send": "The message to send","To enable HTML parsing": "To enable HTML parsing",@@ -26,5 +86,58 @@"A supplementary URL to show with your message.": "A supplementary URL to show with your message.","A title for the URL specified as the url input parameter, otherwise just the URL is shown.": "A title for the URL specified as the url input parameter, otherwise just the URL is shown.","a Unix timestamp of a time to display instead of when our API received it.": "a Unix timestamp of a time to display instead of when our API received it.",- "The name of one of your devices to send just to that device instead of all devices.": "The name of one of your devices to send just to that device instead of all devices."+ "The name of one of your devices to send just to that device instead of all devices.": "The name of one of your devices to send just to that device instead of all devices.",+ "Body of the notification. Required.": "Body of the notification. Required.",+ "Title shown above the message. Defaults to the application name when omitted.": "Title shown above the message. Defaults to the application name when omitted.",+ "Delivery urgency. 2 (emergency) additionally requires Retry and Expire, ignores Time To Live, and returns a receipt.": "Delivery urgency. 2 (emergency) additionally requires Retry and Expire, ignores Time To Live, and returns a receipt.",+ "Emergency priority only. Seconds between repeat deliveries, minimum 30. Pushover stops after 50 retries even if Expire has not elapsed.": "Emergency priority only. Seconds between repeat deliveries, minimum 30. Pushover stops after 50 retries even if Expire has not elapsed.",+ "Emergency priority only. Seconds to keep retrying for, maximum 10800.": "Emergency priority only. Seconds to keep retrying for, maximum 10800.",+ "Seconds after which the notification is auto-deleted from the device. Ignored at emergency priority (2).": "Seconds after which the notification is auto-deleted from the device. Ignored at emergency priority (2).",+ "Notification sound. Leave on the default option to omit the parameter so the recipient device sound applies.": "Notification sound. Leave on the default option to omit the parameter so the recipient device sound applies.",+ "Supplementary URL shown with the message, for example 'https://status.example.com/incident/42'.": "Supplementary URL shown with the message, for example 'https://status.example.com/incident/42'.",+ "Link text for the supplementary URL. The raw URL is shown when omitted.": "Link text for the supplementary URL. The raw URL is shown when omitted.",+ "Deliver only to this device name, for example 'iphone'. All devices receive it when omitted.": "Deliver only to this device name, for example 'iphone'. All devices receive it when omitted.",+ "Unix timestamp to display instead of the receive time, for example '1767225600'.": "Unix timestamp to display instead of the receive time, for example '1767225600'.",+ "Parse a limited HTML subset in the message. Cannot be combined with Monospace.": "Parse a limited HTML subset in the message. Cannot be combined with Monospace.",+ "Render the message in a monospace font. Cannot be combined with Enable HTML.": "Render the message in a monospace font. Cannot be combined with Enable HTML.",+ "Comma-separated tags stored with an emergency notification, for example 'deploy,prod'. Required upfront if you intend to use Cancel Emergency Retries by Tag.": "Comma-separated tags stored with an emergency notification, for example 'deploy,prod'. Required upfront if you intend to use Cancel Emergency Retries by Tag.",+ "Emergency priority only. Pushover POSTs to this URL once the notification is acknowledged.": "Emergency priority only. Pushover POSTs to this URL once the notification is acknowledged.",+ "Base64-encoded image to attach, maximum 5242880 bytes decoded. Requires Attachment Type.": "Base64-encoded image to attach, maximum 5242880 bytes decoded. Requires Attachment Type.",+ "MIME type of the attachment, for example 'image/jpeg'. Required when an attachment is supplied.": "MIME type of the attachment, for example 'image/jpeg'. Required when an attachment is supplied.",+ "Receipt id returned by Send Push Message at emergency priority, for example rXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.": "Receipt id returned by Send Push Message at emergency priority, for example rXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.",+ "Receipt id returned by Send Push Message at emergency priority (2).": "Receipt id returned by Send Push Message at emergency priority (2).",+ "A single tag that was supplied in the Tags parameter at send time, for example deploy. One tag only, with no spaces or slashes.": "A single tag that was supplied in the Tags parameter at send time, for example deploy. One tag only, with no spaces or slashes.",+ "The 30-character user or group key to validate. Defaults to the key stored on the connection when left blank.": "The 30-character user or group key to validate. Defaults to the key stored on the connection when left blank.",+ "Optional device name to validate alongside the key, for example iphone.": "Optional device name to validate alongside the key, for example iphone.",+ "Short description of the data, maximum 100 characters. Omit to leave unchanged. Values cannot be cleared once set.": "Short description of the data, maximum 100 characters. Omit to leave unchanged. Values cannot be cleared once set.",+ "Main line of text, maximum 100 characters. Omit to leave unchanged. Values cannot be cleared once set.": "Main line of text, maximum 100 characters. Omit to leave unchanged. Values cannot be cleared once set.",+ "Second line of text, maximum 100 characters. Omit to leave unchanged. Values cannot be cleared once set.": "Second line of text, maximum 100 characters. Omit to leave unchanged. Values cannot be cleared once set.",+ "Integer shown on the widget, may be negative. Omit to leave unchanged.": "Integer shown on the widget, may be negative. Omit to leave unchanged.",+ "Integer from 0 to 100 rendered as a progress bar. Omit to leave unchanged.": "Integer from 0 to 100 rendered as a progress bar. Omit to leave unchanged.",+ "Update only this device name. All devices are updated when omitted.": "Update only this device name. All devices are updated when omitted.",+ "The 30-character delivery group key. Resolve it with List Delivery Groups; this is not the user key stored on the connection.": "The 30-character delivery group key. Resolve it with List Delivery Groups; this is not the user key stored on the connection.",+ "Name of the delivery group, for example On-Call Engineers. Matching against existing groups ignores case, and the name is returned exactly as Pushover stores it.": "Name of the delivery group, for example On-Call Engineers. Matching against existing groups ignores case, and the name is returned exactly as Pushover stores it.",+ "The 30-character delivery group key. Resolve it with List Delivery Groups.": "The 30-character delivery group key. Resolve it with List Delivery Groups.",+ "The new group name, for example Weekend On-Call.": "The new group name, for example Weekend On-Call.",+ "The 30-character user key of the person to add.": "The 30-character user key of the person to add.",+ "Limit group deliveries to this one device of the user. All of their devices receive them when omitted.": "Limit group deliveries to this one device of the user. All of their devices receive them when omitted.",+ "Note stored with the membership, maximum 200 characters, for example Primary on-call.": "Note stored with the membership, maximum 200 characters, for example Primary on-call.",+ "The 30-character user key of the member to remove. Confirm membership with Get Delivery Group first.": "The 30-character user key of the member to remove. Confirm membership with Get Delivery Group first.",+ "The 30-character user key of the member to suspend. Confirm membership with Get Delivery Group first.": "The 30-character user key of the member to suspend. Confirm membership with Get Delivery Group first.",+ "The 30-character user key of the suspended member. Confirm membership with Get Delivery Group first.": "The 30-character user key of the suspended member. Confirm membership with Get Delivery Group first.",+ "The 30-character user key to license. Supply either this or Email, not both.": "The 30-character user key to license. Supply either this or Email, not both.",+ "Pushover account email of the person to license, used when their user key is unknown. Supply either this or User Key, not both.": "Pushover account email of the person to license, used when their user key is unknown. Supply either this or User Key, not both.",+ "Restrict the license to one platform. Any platform may be used when omitted.": "Restrict the license to one platform. Any platform may be used when omitted.",+ "The subscription code shown on the Pushover subscription page, for example sABCDEFGHIJKLMNOPQRSTUVWXYZ.": "The subscription code shown on the Pushover subscription page, for example sABCDEFGHIJKLMNOPQRSTUVWXYZ.",+ "The existing 30-character user key to migrate. Defaults to the key stored on the connection when left blank.": "The existing 30-character user key to migrate. Defaults to the key stored on the connection when left blank.",+ "Migrate only this one device of the user instead of the whole account.": "Migrate only this one device of the user instead of the whole account.",+ "Default sound to set on the migrated subscription. Resolve an identifier with List Notification Sounds.": "Default sound to set on the migrated subscription. Resolve an identifier with List Notification Sounds.",+ "Lowest (-2, no notification)": "Lowest (-2, no notification)",+ "Low (-1, no sound or vibration)": "Low (-1, no sound or vibration)",+ "Normal (0)": "Normal (0)",+ "High (1, bypasses quiet hours)": "High (1, bypasses quiet hours)",+ "Emergency (2, repeats until acknowledged)": "Emergency (2, repeats until acknowledged)",+ "Android": "Android",+ "iOS": "iOS",+ "Desktop": "Desktop"}\ No newline at end of filediff --git a/packages/pieces/community/pushover/src/index.ts b/packages/pieces/community/pushover/src/index.tsindex d8cc61983a3..3de8dae7c84 100644--- a/packages/pieces/community/pushover/src/index.ts+++ b/packages/pieces/community/pushover/src/index.ts@@ -1,6 +1,25 @@import { PieceAuth, createPiece } from '@activepieces/pieces-framework';import { PieceCategory } from '@activepieces/pieces-framework';import { sendNotification } from './lib/actions/send-notification';+import { sendPushMessage } from './lib/actions/send-push-message';+import { getReceiptStatus } from './lib/actions/get-receipt-status';+import { cancelEmergencyRetries } from './lib/actions/cancel-emergency-retries';+import { cancelEmergencyRetriesByTag } from './lib/actions/cancel-emergency-retries-by-tag';+import { validateUserKey } from './lib/actions/validate-user-key';+import { getAppLimits } from './lib/actions/get-app-limits';+import { updateGlance } from './lib/actions/update-glance';+import { listDeliveryGroups } from './lib/actions/list-delivery-groups';+import { getDeliveryGroup } from './lib/actions/get-delivery-group';+import { createDeliveryGroup } from './lib/actions/create-delivery-group';+import { renameDeliveryGroup } from './lib/actions/rename-delivery-group';+import { addUserToGroup } from './lib/actions/add-user-to-group';+import { removeUserFromGroup } from './lib/actions/remove-user-from-group';+import { disableGroupUser } from './lib/actions/disable-group-user';+import { enableGroupUser } from './lib/actions/enable-group-user';+import { getLicenseCredits } from './lib/actions/get-license-credits';+import { assignLicense } from './lib/actions/assign-license';+import { listNotificationSounds } from './lib/actions/list-notification-sounds';+import { migrateUserToSubscription } from './lib/actions/migrate-user-to-subscription';export const pushoverAuth = PieceAuth.CustomAuth({description: `@@ -37,9 +56,30 @@ export const pushover = createPiece({logoUrl: 'https://cdn.activepieces.com/pieces/pushover.png',categories: [PieceCategory.COMMUNICATION],- minimumSupportedRelease: '0.30.0',+ minimumSupportedRelease: '0.87.0',authors: ["MyWay","Vitalini","kishanprmr","khaledmashaly","abuaboud"],auth: pushoverAuth,- actions: [sendNotification],+ actions: [+ sendNotification,+ sendPushMessage,+ getReceiptStatus,+ cancelEmergencyRetries,+ cancelEmergencyRetriesByTag,+ validateUserKey,+ getAppLimits,+ updateGlance,+ listDeliveryGroups,+ getDeliveryGroup,+ createDeliveryGroup,+ renameDeliveryGroup,+ addUserToGroup,+ removeUserFromGroup,+ disableGroupUser,+ enableGroupUser,+ getLicenseCredits,+ assignLicense,+ listNotificationSounds,+ migrateUserToSubscription,+ ],triggers: [],});diff --git a/packages/pieces/community/pushover/src/lib/actions/add-user-to-group.ts b/packages/pieces/community/pushover/src/lib/actions/add-user-to-group.tsnew file mode 100644index 00000000000..3dc1de85ed0--- /dev/null+++ b/packages/pieces/community/pushover/src/lib/actions/add-user-to-group.ts@@ -0,0 +1,58 @@+import { createAction, Property } from '@activepieces/pieces-framework';+import { HttpMethod } from '@activepieces/pieces-common';+import { pushoverAuth } from '../..';+import { GROUP_OWNERSHIP_HINT, pushoverApiCall } from '../common';+import { addUserToGroupOutputSchema } from '../output-schemas';++export const addUserToGroup = createAction({+ auth: pushoverAuth,+ name: 'add_user_to_group',+ classification: 'WRITE',+ displayName: 'Add User to Delivery Group',+ description: 'Add a user key as a member of a Pushover delivery group',+ audience: 'ai',+ aiMetadata: {+ description:+ 'Add one user key to a delivery group so the group key also delivers to them. Resolve the group key with List Delivery Groups and validate the user key with Validate User or Group Key first. Not idempotent: adding a user who is already a member fails, so check the members with Get Delivery Group before retrying. To restore a suspended member use Enable Group User instead.',+ idempotent: false,+ },+ props: {+ group_key: Property.ShortText({+ displayName: 'Group Key',+ description:+ 'The 30-character delivery group key. Resolve it with List Delivery Groups.',+ required: true,+ }),+ user: Property.ShortText({+ displayName: 'User Key',+ description: 'The 30-character user key of the person to add.',+ required: true,+ }),+ device: Property.ShortText({+ displayName: 'Device',+ description:+ 'Limit group deliveries to this one device of the user. All of their devices receive them when omitted.',+ required: false,+ }),+ memo: Property.ShortText({+ displayName: 'Memo',+ description:+ 'Note stored with the membership, maximum 200 characters, for example Primary on-call.',+ required: false,+ }),+ },+ outputSchema: addUserToGroupOutputSchema,+ async run({ auth, propsValue }) {+ return await pushoverApiCall({+ method: HttpMethod.POST,+ resourceUri: `/groups/${encodeURIComponent(propsValue.group_key)}/add_user.json`,+ body: {+ token: auth.props.api_token,+ user: propsValue.user,+ ...(propsValue.device ? { device: propsValue.device } : {}),+ ...(propsValue.memo ? { memo: propsValue.memo } : {}),+ },+ errorHint: GROUP_OWNERSHIP_HINT,+ });+ },+});diff --git a/packages/pieces/community/pushover/src/lib/actions/assign-license.ts b/packages/pieces/community/pushover/src/lib/actions/assign-license.tsnew file mode 100644index 00000000000..9ba5e673797--- /dev/null+++ b/packages/pieces/community/pushover/src/lib/actions/assign-license.ts@@ -0,0 +1,66 @@+import { createAction, Property } from '@activepieces/pieces-framework';+import { HttpMethod } from '@activepieces/pieces-common';+import { pushoverAuth } from '../..';+import { pushoverApiCall } from '../common';++export const assignLicense = createAction({+ auth: pushoverAuth,+ name: 'assign_license',+ classification: 'WRITE',+ displayName: 'Assign License',+ description: 'Spend a prepaid credit to license a Pushover user',+ audience: 'ai',+ aiMetadata: {+ description:+ 'Assign a Pushover license to one user, identified by either their user key or their account email. This spends one prepaid credit, costs real money and cannot be revoked: there is no unassign endpoint. Check the balance with Get License Credits first and only call it when a human has explicitly asked for this person to be licensed. Not idempotent: a repeat call spends another credit.',+ idempotent: false,+ },+ props: {+ user: Property.ShortText({+ displayName: 'User Key',+ description:+ 'The 30-character user key to license. Supply either this or Email, not both.',+ required: false,+ }),+ email: Property.ShortText({+ displayName: 'Email',+ description:+ 'Pushover account email of the person to license, used when their user key is unknown. Supply either this or User Key, not both.',+ required: false,+ }),+ os: Property.StaticDropdown({+ displayName: 'Operating System',+ description:+ 'Restrict the license to one platform. Any platform may be used when omitted.',+ required: false,+ options: {+ options: [+ { label: 'Android', value: 'Android' },+ { label: 'iOS', value: 'iOS' },+ { label: 'Desktop', value: 'Desktop' },+ ],+ },+ }),+ },+ async run({ auth, propsValue }) {+ const hasUser = propsValue.user !== undefined && propsValue.user.length > 0;+ const hasEmail =+ propsValue.email !== undefined && propsValue.email.length > 0;+ if (hasUser === hasEmail) {+ throw new Error(+ 'Assign License needs exactly one of User Key or Email to identify the recipient.'+ );+ }++ return await pushoverApiCall({+ method: HttpMethod.POST,+ resourceUri: '/licenses/assign.json',+ body: {+ token: auth.props.api_token,+ ...(hasUser ? { user: propsValue.user } : {}),+ ...(hasEmail ? { email: propsValue.email } : {}),+ ...(propsValue.os ? { os: propsValue.os } : {}),+ },+ });+ },+});diff --git a/packages/pieces/community/pushover/src/lib/actions/cancel-emergency-retries-by-tag.ts b/packages/pieces/community/pushover/src/lib/actions/cancel-emergency-retries-by-tag.tsnew file mode 100644index 00000000000..621f918039c--- /dev/null+++ b/packages/pieces/community/pushover/src/lib/actions/cancel-emergency-retries-by-tag.ts@@ -0,0 +1,35 @@+import { createAction, Property } from '@activepieces/pieces-framework';+import { HttpMethod } from '@activepieces/pieces-common';+import { pushoverAuth } from '../..';+import { pushoverApiCall } from '../common';+import { cancelEmergencyRetriesByTagOutputSchema } from '../output-schemas';++export const cancelEmergencyRetriesByTag = createAction({+ auth: pushoverAuth,+ name: 'cancel_emergency_retries_by_tag',+ classification: 'WRITE',+ displayName: 'Cancel Emergency Retries by Tag',+ description: 'Stop the retry loops of every emergency notification carrying a tag',+ audience: 'ai',+ aiMetadata: {+ description:+ 'Stop the retries of every still-active emergency (priority 2) notification sent with this tag. The tag must have been supplied in the Tags parameter of Send Push Message at send time; tags cannot be attached afterwards. Use Cancel Emergency Retries when you hold a single receipt instead. Safe to retry: it is a no-op once nothing with the tag is retrying.',+ idempotent: true,+ },+ props: {+ tag: Property.ShortText({+ displayName: 'Tag',+ description:+ 'A single tag that was supplied in the Tags parameter at send time, for example deploy. One tag only, with no spaces or slashes.',+ required: true,+ }),+ },+ outputSchema: cancelEmergencyRetriesByTagOutputSchema,+ async run({ auth, propsValue }) {+ return await pushoverApiCall({+ method: HttpMethod.POST,+ resourceUri: `/receipts/cancel_by_tag/${encodeURIComponent(propsValue.tag)}.json`,+ body: { token: auth.props.api_token },+ });+ },+});diff --git a/packages/pieces/community/pushover/src/lib/actions/cancel-emergency-retries.ts b/packages/pieces/community/pushover/src/lib/actions/cancel-emergency-retries.tsnew file mode 100644index 00000000000..62d31aa3628--- /dev/null+++ b/packages/pieces/community/pushover/src/lib/actions/cancel-emergency-retries.ts@@ -0,0 +1,37 @@+import { createAction, Property } from '@activepieces/pieces-framework';+import { HttpMethod } from '@activepieces/pieces-common';+import { pushoverAuth } from '../..';+import { pushoverApiCall } from '../common';+import { cancelEmergencyRetriesOutputSchema } from '../output-schemas';++export const cancelEmergencyRetries = createAction({+ auth: pushoverAuth,+ name: 'cancel_emergency_retries',+ classification: 'WRITE',+ displayName: 'Cancel Emergency Retries',+ description: 'Stop the retry loop of one emergency notification receipt',+ audience: 'ai',+ aiMetadata: {+ description:+ 'Stop Pushover from resending one emergency (priority 2) notification, identified by the receipt returned by Send Push Message. Use it once the underlying incident is resolved so the recipient stops being re-alerted; it deletes nothing and already-delivered notifications stay. To stop many notifications at once use Cancel Emergency Retries by Tag. Safe to retry: cancelling an already-cancelled receipt is a no-op.',+ idempotent: true,+ },+ props: {+ receipt: Property.ShortText({+ displayName: 'Receipt',+ description:+ 'Receipt id returned by Send Push Message at emergency priority (2).',+ required: true,+ }),+ },+ outputSchema: cancelEmergencyRetriesOutputSchema,+ async run({ auth, propsValue }) {+ return await pushoverApiCall({+ method: HttpMethod.POST,+ resourceUri: `/receipts/${encodeURIComponent(propsValue.receipt)}/cancel.json`,+ body: { token: auth.props.api_token },+ errorHint:+ 'Receipts expire after about one week and only exist for priority 2 notifications.',+ });+ },+});diff --git a/packages/pieces/community/pushover/src/lib/actions/create-delivery-group.ts b/packages/pieces/community/pushover/src/lib/actions/create-delivery-group.tsnew file mode 100644index 00000000000..a943c21df0d--- /dev/null+++ b/packages/pieces/community/pushover/src/lib/actions/create-delivery-group.ts@@ -0,0 +1,128 @@+import { createAction, Property } from '@activepieces/pieces-framework';+import { HttpMethod } from '@activepieces/pieces-common';+import { pushoverAuth } from '../..';+import {+ GROUP_OWNERSHIP_HINT,+ PushoverRequestError,+ pushoverApiCall,+} from '../common';+import { createDeliveryGroupOutputSchema } from '../output-schemas';++export const createDeliveryGroup = createAction({+ auth: pushoverAuth,+ name: 'create_delivery_group',+ classification: 'WRITE',+ displayName: 'Create Delivery Group',+ description: 'Create a Pushover delivery group, or return the existing one with that name',+ audience: 'ai',+ aiMetadata: {+ description:+ 'Get or create a delivery group by name and return its group key. Pushover allows only one group per name on an account, so this action lists the existing groups first and returns the case-insensitive match with created=false instead of failing; it only creates when the name is unused, returning created=true. Safe to retry: a second call with the same name returns the same group key. Add members afterwards with Add User to Delivery Group.',+ idempotent: true,+ },+ props: {+ name: Property.ShortText({+ displayName: 'Name',+ description:+ 'Name of the delivery group, for example On-Call Engineers. Matching against existing groups ignores case, and the name is returned exactly as Pushover stores it.',+ required: true,+ }),+ },+ outputSchema: createDeliveryGroupOutputSchema,+ async run({ auth, propsValue }) {+ const existing = await findGroupByName({+ apiToken: auth.props.api_token,+ name: propsValue.name,+ });+ if (existing !== undefined) {+ return {+ group: existing.group,+ name: existing.name,+ created: false,+ };+ }++ try {+ const created = await pushoverApiCall<CreateGroupResponse>({+ method: HttpMethod.POST,+ resourceUri: '/groups.json',+ body: {+ token: auth.props.api_token,+ name: propsValue.name,+ },+ errorHint: GROUP_OWNERSHIP_HINT,+ });++ return {+ group: created.group,+ name: propsValue.name,+ created: true,+ };+ } catch (error) {+ if (!isNameAlreadyTakenError(error)) {+ throw error;+ }+ const raced = await findGroupByName({+ apiToken: auth.props.api_token,+ name: propsValue.name,+ });+ if (raced === undefined) {+ throw error;+ }+ return {+ group: raced.group,+ name: raced.name,+ created: false,+ };+ }+ },+});++async function findGroupByName({+ apiToken,+ name,+}: FindGroupByNameParams): Promise<PushoverGroup | undefined> {+ const existingGroups = await pushoverApiCall<GroupsResponse>({+ method: HttpMethod.GET,+ resourceUri: '/groups.json',+ queryParams: { token: apiToken },+ errorHint: GROUP_OWNERSHIP_HINT,+ });+ const wanted = name.trim().toLowerCase();+ return (existingGroups.groups ?? []).find(+ (group) => group.name.trim().toLowerCase() === wanted+ );+}++function isNameAlreadyTakenError(error: unknown): boolean {+ if (error instanceof PushoverRequestError) {+ if (error.status !== undefined && error.status >= 500) {+ return false;+ }+ if (error.vendorErrors.length > 0) {+ return error.vendorErrors.some((entry) => NAME_TAKEN_PATTERN.test(entry));+ }+ }+ const message = error instanceof Error ? error.message : String(error);+ return NAME_TAKEN_PATTERN.test(message);+}++const NAME_TAKEN_PATTERN = /already (exists|been taken|in use)|has already been|must be unique/i;++type PushoverGroup = {+ group: string;+ name: string;+};++type GroupsResponse = {+ groups: PushoverGroup[];+};++type FindGroupByNameParams = {+ apiToken: string;+ name: string;+};++type CreateGroupResponse = {+ group: string;+};diff --git a/packages/pieces/community/pushover/src/lib/actions/disable-group-user.ts b/packages/pieces/community/pushover/src/lib/actions/disable-group-user.tsnew file mode 100644index 00000000000..edbccc04b08--- /dev/null+++ b/packages/pieces/community/pushover/src/lib/actions/disable-group-user.ts@@ -0,0 +1,45 @@+import { createAction, Property } from '@activepieces/pieces-framework';+import { HttpMethod } from '@activepieces/pieces-common';+import { pushoverAuth } from '../..';+import { GROUP_OWNERSHIP_HINT, pushoverApiCall } from '../common';+import { disableGroupUserOutputSchema } from '../output-schemas';++export const disableGroupUser = createAction({+ auth: pushoverAuth,+ name: 'disable_group_user',+ classification: 'WRITE',+ displayName: 'Disable Group User',+ description: 'Temporarily stop a group member from receiving group messages',+ audience: 'ai',+ aiMetadata: {+ description:+ 'Suspend one member of a delivery group so group messages skip them while their membership, device and memo are kept. This is the reversible alternative to Remove User from Delivery Group: undo it with Enable Group User. Safe to retry: disabling an already-disabled member converges on the same state.',+ idempotent: true,+ },+ props: {+ group_key: Property.ShortText({+ displayName: 'Group Key',+ description:+ 'The 30-character delivery group key. Resolve it with List Delivery Groups.',+ required: true,+ }),+ user: Property.ShortText({+ displayName: 'User Key',+ description:+ 'The 30-character user key of the member to suspend. Confirm membership with Get Delivery Group first.',+ required: true,+ }),+ },+ outputSchema: disableGroupUserOutputSchema,+ async run({ auth, propsValue }) {+ return await pushoverApiCall({+ method: HttpMethod.POST,+ resourceUri: `/groups/${encodeURIComponent(propsValue.group_key)}/disable_user.json`,+ body: {+ token: auth.props.api_token,+ user: propsValue.user,+ },+ errorHint: GROUP_OWNERSHIP_HINT,+ });+ },+});diff --git a/packages/pieces/community/pushover/src/lib/actions/enable-group-user.ts b/packages/pieces/community/pushover/src/lib/actions/enable-group-user.tsnew file mode 100644index 00000000000..b6315a9fff4--- /dev/null+++ b/packages/pieces/community/pushover/src/lib/actions/enable-group-user.ts@@ -0,0 +1,45 @@+import { createAction, Property } from '@activepieces/pieces-framework';+import { HttpMethod } from '@activepieces/pieces-common';+import { pushoverAuth } from '../..';+import { GROUP_OWNERSHIP_HINT, pushoverApiCall } from '../common';+import { enableGroupUserOutputSchema } from '../output-schemas';++export const enableGroupUser = createAction({+ auth: pushoverAuth,+ name: 'enable_group_user',+ classification: 'WRITE',+ displayName: 'Enable Group User',+ description: 'Resume group deliveries to a suspended group member',+ audience: 'ai',+ aiMetadata: {+ description:+ 'Re-enable a member of a delivery group who was suspended with Disable Group User, so group messages reach them again. It only works on someone who is still a member: a user removed with Remove User from Delivery Group has to be re-added with Add User to Delivery Group. Safe to retry: enabling an already-enabled member converges on the same state.',+ idempotent: true,+ },+ props: {+ group_key: Property.ShortText({+ displayName: 'Group Key',+ description:+ 'The 30-character delivery group key. Resolve it with List Delivery Groups.',+ required: true,+ }),+ user: Property.ShortText({+ displayName: 'User Key',+ description:+ 'The 30-character user key of the suspended member. Confirm membership with Get Delivery Group first.',+ required: true,+ }),+ },+ outputSchema: enableGroupUserOutputSchema,+ async run({ auth, propsValue }) {+ return await pushoverApiCall({+ method: HttpMethod.POST,+ resourceUri: `/groups/${encodeURIComponent(propsValue.group_key)}/enable_user.json`,+ body: {+ token: auth.props.api_token,+ user: propsValue.user,+ },+ errorHint: GROUP_OWNERSHIP_HINT,+ });+ },+});diff --git a/packages/pieces/community/pushover/src/lib/actions/get-app-limits.ts b/packages/pieces/community/pushover/src/lib/actions/get-app-limits.tsnew file mode 100644index 00000000000..b48d4032b4a--- /dev/null+++ b/packages/pieces/community/pushover/src/lib/actions/get-app-limits.ts@@ -0,0 +1,28 @@+import { createAction } from '@activepieces/pieces-framework';+import { HttpMethod } from '@activepieces/pieces-common';+import { pushoverAuth } from '../..';+import { pushoverApiCall } from '../common';+import { getAppLimitsOutputSchema } from '../output-schemas';++export const getAppLimits = createAction({+ auth: pushoverAuth,+ name: 'get_app_limits',+ classification: 'READ',+ displayName: 'Get Monthly Message Limits',+ description: 'Read the monthly message allowance and remaining quota of the application',+ audience: 'ai',+ aiMetadata: {+ description:+ 'Read the monthly message allowance of the application, how many messages remain, and the Unix timestamp when the counter resets. Use it before a bulk send, or to explain a 429 from Send Push Message, which means the monthly quota is exhausted rather than transient throttling. Takes no input. Safe to retry.',+ idempotent: true,+ },+ props: {},+ outputSchema: getAppLimitsOutputSchema,+ async run({ auth }) {+ return await pushoverApiCall({+ method: HttpMethod.GET,+ resourceUri: '/apps/limits.json',+ queryParams: { token: auth.props.api_token },+ });+ },+});diff --git a/packages/pieces/community/pushover/src/lib/actions/get-delivery-group.ts b/packages/pieces/community/pushover/src/lib/actions/get-delivery-group.tsnew file mode 100644index 00000000000..9e207ad374c--- /dev/null+++ b/packages/pieces/community/pushover/src/lib/actions/get-delivery-group.ts@@ -0,0 +1,36 @@+import { createAction, Property } from '@activepieces/pieces-framework';+import { HttpMethod } from '@activepieces/pieces-common';+import { pushoverAuth } from '../..';+import { GROUP_OWNERSHIP_HINT, pushoverApiCall } from '../common';+import { getDeliveryGroupOutputSchema } from '../output-schemas';++export const getDeliveryGroup = createAction({+ auth: pushoverAuth,+ name: 'get_delivery_group',+ classification: 'READ',+ displayName: 'Get Delivery Group',+ description: 'Read the name and members of one Pushover delivery group',+ audience: 'ai',+ aiMetadata: {+ description:+ 'Read one delivery group: its name and every member, including each member device, memo and whether the member is currently disabled. Use it to check membership before adding, removing, disabling or enabling a user. Resolve the group key with List Delivery Groups first. Safe to retry.',+ idempotent: true,+ },+ props: {+ group_key: Property.ShortText({+ displayName: 'Group Key',+ description:+ 'The 30-character delivery group key. Resolve it with List Delivery Groups; this is not the user key stored on the connection.',+ required: true,+ }),+ },+ outputSchema: getDeliveryGroupOutputSchema,+ async run({ auth, propsValue }) {+ return await pushoverApiCall({+ method: HttpMethod.GET,+ resourceUri: `/groups/${encodeURIComponent(propsValue.group_key)}.json`,+ queryParams: { token: auth.props.api_token },+ errorHint: GROUP_OWNERSHIP_HINT,+ });+ },+});diff --git a/packages/pieces/community/pushover/src/lib/actions/get-license-credits.ts b/packages/pieces/community/pushover/src/lib/actions/get-license-credits.tsnew file mode 100644index 00000000000..640b221ea4b--- /dev/null+++ b/packages/pieces/community/pushover/src/lib/actions/get-license-credits.ts@@ -0,0 +1,28 @@+import { createAction } from '@activepieces/pieces-framework';+import { HttpMethod } from '@activepieces/pieces-common';+import { pushoverAuth } from '../..';+import { pushoverApiCall } from '../common';+import { getLicenseCreditsOutputSchema } from '../output-schemas';++export const getLicenseCredits = createAction({+ auth: pushoverAuth,+ name: 'get_license_credits',+ classification: 'READ',+ displayName: 'Get License Credits',+ description: 'Read how many prepaid Pushover license credits remain',+ audience: 'ai',+ aiMetadata: {+ description:+ 'Read how many prepaid Pushover license credits the application still holds. Call it before Assign License, which spends one credit irreversibly. Takes no input. Safe to retry.',+ idempotent: true,+ },+ props: {},+ outputSchema: getLicenseCreditsOutputSchema,+ async run({ auth }) {+ return await pushoverApiCall({+ method: HttpMethod.GET,+ resourceUri: '/licenses.json',+ queryParams: { token: auth.props.api_token },+ });+ },+});diff --git a/packages/pieces/community/pushover/src/lib/actions/get-receipt-status.ts b/packages/pieces/community/pushover/src/lib/actions/get-receipt-status.tsnew file mode 100644index 00000000000..cc07ce8c0fa--- /dev/null+++ b/packages/pieces/community/pushover/src/lib/actions/get-receipt-status.ts@@ -0,0 +1,37 @@+import { createAction, Property } from '@activepieces/pieces-framework';+import { HttpMethod } from '@activepieces/pieces-common';+import { pushoverAuth } from '../..';+import { pushoverApiCall } from '../common';+import { getReceiptStatusOutputSchema } from '../output-schemas';++export const getReceiptStatus = createAction({+ auth: pushoverAuth,+ name: 'get_receipt_status',+ classification: 'READ',+ displayName: 'Get Emergency Receipt Status',+ description: 'Read the acknowledgement status of an emergency notification receipt',+ audience: 'ai',+ aiMetadata: {+ description:+ 'Read whether an emergency (priority 2) notification has been acknowledged, and whether its retries have expired. The receipt comes from Send Push Message sent at priority 2; no other priority produces one. This is a single read, not a wait loop: re-call it at most once every 5 seconds until acknowledged is 1 or expired is 1. Receipts stay valid for up to one week and older ids return an error. Safe to retry.',+ idempotent: true,+ },+ props: {+ receipt: Property.ShortText({+ displayName: 'Receipt',+ description:+ 'Receipt id returned by Send Push Message at emergency priority, for example rXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.',+ required: true,+ }),+ },+ outputSchema: getReceiptStatusOutputSchema,+ async run({ auth, propsValue }) {+ return await pushoverApiCall({+ method: HttpMethod.GET,+ resourceUri: `/receipts/${encodeURIComponent(propsValue.receipt)}.json`,+ queryParams: { token: auth.props.api_token },+ errorHint:+ 'Receipts expire after about one week and only exist for priority 2 notifications.',+ });+ },+});diff --git a/packages/pieces/community/pushover/src/lib/actions/list-delivery-groups.ts b/packages/pieces/community/pushover/src/lib/actions/list-delivery-groups.tsnew file mode 100644index 00000000000..586af0d3457--- /dev/null+++ b/packages/pieces/community/pushover/src/lib/actions/list-delivery-groups.ts@@ -0,0 +1,43 @@+import { createAction } from '@activepieces/pieces-framework';+import { HttpMethod } from '@activepieces/pieces-common';+import { pushoverAuth } from '../..';+import { GROUP_OWNERSHIP_HINT, pushoverApiCall } from '../common';+import { listDeliveryGroupsOutputSchema } from '../output-schemas';++export const listDeliveryGroups = createAction({+ auth: pushoverAuth,+ name: 'list_delivery_groups',+ classification: 'READ',+ displayName: 'List Delivery Groups',+ description: 'List the delivery groups owned by the Pushover account',+ audience: 'ai',+ aiMetadata: {+ description:+ 'List every delivery group on the account with its group key and name. This is the id resolver for every other group action: call it first to turn a group name into the group key that Get Delivery Group, Add User to Delivery Group and the rest require. Only groups owned by the same account as the application token are visible. Takes no input. Safe to retry.',+ idempotent: true,+ },+ props: {},+ outputSchema: listDeliveryGroupsOutputSchema,+ async run({ auth }) {+ const response = await pushoverApiCall<GroupsResponse>({+ method: HttpMethod.GET,+ resourceUri: '/groups.json',+ queryParams: { token: auth.props.api_token },+ errorHint: GROUP_OWNERSHIP_HINT,+ });+ const groups = response.groups ?? [];++ return {+ groups,+ count: groups.length,+ status: response.status,+ request: response.request,+ };+ },+});++type GroupsResponse = {+ groups: { group: string; name: string }[];+ status: number;+ request: string;+};diff --git a/packages/pieces/community/pushover/src/lib/actions/list-notification-sounds.ts b/packages/pieces/community/pushover/src/lib/actions/list-notification-sounds.tsnew file mode 100644index 00000000000..fc602962a6f--- /dev/null+++ b/packages/pieces/community/pushover/src/lib/actions/list-notification-sounds.ts@@ -0,0 +1,45 @@+import { createAction } from '@activepieces/pieces-framework';+import { HttpMethod } from '@activepieces/pieces-common';+import { pushoverAuth } from '../..';+import { pushoverApiCall } from '../common';+import { listNotificationSoundsOutputSchema } from '../output-schemas';++export const listNotificationSounds = createAction({+ auth: pushoverAuth,+ name: 'list_notification_sounds',+ classification: 'READ',+ displayName: 'List Notification Sounds',+ description: 'List the notification sound identifiers Pushover accepts',+ audience: 'ai',+ aiMetadata: {+ description:+ 'List every sound identifier Pushover accepts, each with its human-readable name. Call it to resolve a sound before setting the Sound parameter of Send Push Message instead of guessing an identifier; omit the sound entirely to leave the recipient device default in place. Takes no input. Safe to retry.',+ idempotent: true,+ },+ props: {},+ outputSchema: listNotificationSoundsOutputSchema,+ async run({ auth }) {+ const response = await pushoverApiCall<SoundsResponse>({+ method: HttpMethod.GET,+ resourceUri: '/sounds.json',+ queryParams: { token: auth.props.api_token },+ });+ const sounds = Object.entries(response.sounds ?? {}).map(([id, name]) => ({+ id,+ name,+ }));++ return {+ sounds,+ count: sounds.length,+ status: response.status,+ request: response.request,+ };+ },+});++type SoundsResponse = {+ sounds: Record<string, string>;+ status: number;+ request: string;+};diff --git a/packages/pieces/community/pushover/src/lib/actions/migrate-user-to-subscription.ts b/packages/pieces/community/pushover/src/lib/actions/migrate-user-to-subscription.tsnew file mode 100644index 00000000000..9363cbec8ad--- /dev/null+++ b/packages/pieces/community/pushover/src/lib/actions/migrate-user-to-subscription.ts@@ -0,0 +1,65 @@+import { createAction, Property } from '@activepieces/pieces-framework';+import { HttpMethod } from '@activepieces/pieces-common';+import { pushoverAuth } from '../..';+import { pushoverApiCall } from '../common';++export const migrateUserToSubscription = createAction({+ auth: pushoverAuth,+ name: 'migrate_user_to_subscription',+ classification: 'WRITE',+ displayName: 'Migrate User to Subscription',+ description: 'Convert an existing user key into a subscribed user key',+ audience: 'ai',+ aiMetadata: {+ description:+ 'Convert a user key that already authorised this application into a subscription-specific user key, returning subscribed_user_key. Only meaningful for an application owner running a Pushover subscription, and it needs the subscription code from the subscription page; there is no programmatic way to subscribe someone who has not gone through the subscription URL. Send future messages to the returned key. Not idempotent: call it once per user and store the result.',+ idempotent: false,+ },+ props: {+ subscription: Property.ShortText({+ displayName: 'Subscription Code',+ description:+ 'The subscription code shown on the Pushover subscription page, for example sABCDEFGHIJKLMNOPQRSTUVWXYZ.',+ required: true,+ }),+ user: Property.ShortText({+ displayName: 'User Key',+ description:+ 'The existing 30-character user key to migrate. Defaults to the key stored on the connection when left blank.',+ required: false,+ }),+ device_name: Property.ShortText({+ displayName: 'Device Name',+ description:+ 'Migrate only this one device of the user instead of the whole account.',+ required: false,+ }),+ sound: Property.ShortText({+ displayName: 'Sound',+ description:+ 'Default sound to set on the migrated subscription. Resolve an identifier with List Notification Sounds.',+ required: false,+ }),+ },+ async run({ auth, propsValue }) {+ const suppliedUser = propsValue.user;+ const user =+ suppliedUser !== undefined && suppliedUser.length > 0+ ? suppliedUser+ : auth.props.user_key;++ return await pushoverApiCall({+ method: HttpMethod.POST,+ resourceUri: '/subscriptions/migrate.json',+ body: {+ token: auth.props.api_token,+ subscription: propsValue.subscription,+ user,+ ...(propsValue.device_name+ ? { device_name: propsValue.device_name }+ : {}),+ ...(propsValue.sound ? { sound: propsValue.sound } : {}),+ },+ });+ },+});diff --git a/packages/pieces/community/pushover/src/lib/actions/remove-user-from-group.ts b/packages/pieces/community/pushover/src/lib/actions/remove-user-from-group.tsnew file mode 100644index 00000000000..37034ba60d3--- /dev/null+++ b/packages/pieces/community/pushover/src/lib/actions/remove-user-from-group.ts@@ -0,0 +1,45 @@+import { createAction, Property } from '@activepieces/pieces-framework';+import { HttpMethod } from '@activepieces/pieces-common';+import { pushoverAuth } from '../..';+import { GROUP_OWNERSHIP_HINT, pushoverApiCall } from '../common';+import { removeUserFromGroupOutputSchema } from '../output-schemas';++export const removeUserFromGroup = createAction({+ auth: pushoverAuth,+ name: 'remove_user_from_group',+ classification: 'WRITE',+ displayName: 'Remove User from Delivery Group',+ description: 'Permanently remove a member from a Pushover delivery group',+ audience: 'ai',+ aiMetadata: {+ description:+ 'Permanently remove a user key from a delivery group, discarding their device and memo settings. Prefer Disable Group User when the person should stop receiving messages only temporarily, since that is reversible with Enable Group User and this is not. Not idempotent: a repeat call for a user who is no longer a member fails with "user is not a member of this group", so confirm membership with Get Delivery Group before retrying. Re-adding afterwards is a fresh membership, not an undo.',+ idempotent: false,+ },+ props: {+ group_key: Property.ShortText({+ displayName: 'Group Key',+ description:+ 'The 30-character delivery group key. Resolve it with List Delivery Groups.',+ required: true,+ }),+ user: Property.ShortText({+ displayName: 'User Key',+ description:+ 'The 30-character user key of the member to remove. Confirm membership with Get Delivery Group first.',+ required: true,+ }),+ },+ outputSchema: removeUserFromGroupOutputSchema,+ async run({ auth, propsValue }) {+ return await pushoverApiCall({+ method: HttpMethod.POST,+ resourceUri: `/groups/${encodeURIComponent(propsValue.group_key)}/remove_user.json`,+ body: {+ token: auth.props.api_token,+ user: propsValue.user,+ },+ errorHint: GROUP_OWNERSHIP_HINT,+ });+ },+});diff --git a/packages/pieces/community/pushover/src/lib/actions/rename-delivery-group.ts b/packages/pieces/community/pushover/src/lib/actions/rename-delivery-group.tsnew file mode 100644index 00000000000..1b05fa97d62--- /dev/null+++ b/packages/pieces/community/pushover/src/lib/actions/rename-delivery-group.ts@@ -0,0 +1,44 @@+import { createAction, Property } from '@activepieces/pieces-framework';+import { HttpMethod } from '@activepieces/pieces-common';+import { pushoverAuth } from '../..';+import { GROUP_OWNERSHIP_HINT, pushoverApiCall } from '../common';+import { renameDeliveryGroupOutputSchema } from '../output-schemas';++export const renameDeliveryGroup = createAction({+ auth: pushoverAuth,+ name: 'rename_delivery_group',+ classification: 'WRITE',+ displayName: 'Rename Delivery Group',+ description: 'Change the name of a Pushover delivery group',+ audience: 'ai',+ aiMetadata: {+ description:+ 'Rename one delivery group. The group key never changes, so existing flows keep delivering. Only one group per name may exist on an account, so renaming onto a name already in use fails: check with List Delivery Groups first. Safe to retry: renaming to the name it already has converges on the same state.',+ idempotent: true,+ },+ props: {+ group_key: Property.ShortText({+ displayName: 'Group Key',+ description:+ 'The 30-character delivery group key. Resolve it with List Delivery Groups.',+ required: true,+ }),+ name: Property.ShortText({+ displayName: 'New Name',+ description: 'The new group name, for example Weekend On-Call.',+ required: true,+ }),+ },+ outputSchema: renameDeliveryGroupOutputSchema,+ async run({ auth, propsValue }) {+ return await pushoverApiCall({+ method: HttpMethod.POST,+ resourceUri: `/groups/${encodeURIComponent(propsValue.group_key)}/rename.json`,+ body: {+ token: auth.props.api_token,+ name: propsValue.name,+ },+ errorHint: GROUP_OWNERSHIP_HINT,+ });+ },+});diff --git a/packages/pieces/community/pushover/src/lib/actions/send-notification.ts b/packages/pieces/community/pushover/src/lib/actions/send-notification.tsindex 76df6e33a62..9a08a4f5b61 100644--- a/packages/pieces/community/pushover/src/lib/actions/send-notification.ts+++ b/packages/pieces/community/pushover/src/lib/actions/send-notification.ts@@ -1,6 +1,7 @@import { createAction, Property } from '@activepieces/pieces-framework';import { httpClient, HttpMethod } from '@activepieces/pieces-common';import { pushoverAuth } from '../..';+import { buildMessageBody } from '../common';import { sendNotificationActionOutputSchema } from '../output-schemas';export const sendNotification = createAction({@@ -9,7 +10,7 @@ export const sendNotification = createAction({classification: 'WRITE',displayName: 'Send Notification',description: 'Send a notification to Pushover',- audience: 'both',+ audience: 'human',aiMetadata: {description: 'Sends a push notification through Pushover to the device(s) tied to the configured user/group key. Use to alert a person or group on their phone/desktop. The message body is required; optional priority (-2 to 2) controls urgency, and emergency priority (2) additionally requires retry and expire values. Not idempotent: each call delivers a new notification.',idempotent: false,@@ -74,38 +75,25 @@ export const sendNotification = createAction({},outputSchema: sendNotificationActionOutputSchema,async run({ auth, propsValue }) {- const baseUrl = 'https://api.pushover.net/1/messages.json';- const apiToken = auth.props.api_token;- const userKey = auth.props.user_key;-- const title = propsValue.title;- const message = propsValue.message;- const html = propsValue.html;- const priority = propsValue.priority;- const url = propsValue.url;- const url_title = propsValue.url_title;- const timestamp = propsValue.timestamp;- const device = propsValue.device;- const retry = propsValue.retry;- const expire = propsValue.expire;+ const body = buildMessageBody({+ apiToken: auth.props.api_token,+ userKey: auth.props.user_key,+ message: propsValue.message,+ title: propsValue.title,+ html: propsValue.html,+ priority: propsValue.priority,+ retry: propsValue.retry,+ expire: propsValue.expire,+ url: propsValue.url,+ urlTitle: propsValue.url_title,+ timestamp: propsValue.timestamp,+ device: propsValue.device,+ });return await httpClient.sendRequest({method: HttpMethod.POST,- url: baseUrl,- body: {- token: apiToken,- user: userKey,- title,- message,- html: html ? 1 : 0,- url,- url_title,- timestamp,- device,- ...(priority && { priority: +priority }),- ...(retry && { retry: +retry }),- ...(expire && { expire: +expire }),- },+ url: 'https://api.pushover.net/1/messages.json',+ body,});},});diff --git a/packages/pieces/community/pushover/src/lib/actions/send-push-message.ts b/packages/pieces/community/pushover/src/lib/actions/send-push-message.tsnew file mode 100644index 00000000000..a79adf7cb1e--- /dev/null+++ b/packages/pieces/community/pushover/src/lib/actions/send-push-message.ts@@ -0,0 +1,188 @@+import { createAction, Property } from '@activepieces/pieces-framework';+import { HttpMethod } from '@activepieces/pieces-common';+import { pushoverAuth } from '../..';+import { buildMessageBody, pushoverApiCall } from '../common';+import { sendPushMessageOutputSchema } from '../output-schemas';++export const sendPushMessage = createAction({+ auth: pushoverAuth,+ name: 'send_push_message',+ classification: 'WRITE',+ displayName: 'Send Push Message',+ description: 'Send a push message through Pushover with the full parameter set',+ audience: 'ai',+ aiMetadata: {+ description:+ 'Send a push notification to the user or group key on the connection, exposing every Pushover message parameter (sound, ttl, tags, attachment, monospace, callback). Emergency priority 2 requires both retry (>= 30 seconds) and expire (<= 10800 seconds), is capped at 50 total retries regardless of expire (retry=30 with expire=10800 therefore stops after about 25 minutes), ignores ttl, and is the only priority that returns a receipt for Get Emergency Receipt Status and the cancel actions. Not idempotent: every call delivers a new notification.',+ idempotent: false,+ },+ props: {+ message: Property.LongText({+ displayName: 'Message',+ description: 'Body of the notification. Required.',+ required: true,+ }),+ title: Property.ShortText({+ displayName: 'Title',+ description:+ 'Title shown above the message. Defaults to the application name when omitted.',+ required: false,+ }),+ priority: Property.StaticDropdown({+ displayName: 'Priority',+ description:+ 'Delivery urgency. 2 (emergency) additionally requires Retry and Expire, ignores Time To Live, and returns a receipt.',+ required: false,+ options: {+ options: [+ { label: 'Lowest (-2, no notification)', value: -2 },+ { label: 'Low (-1, no sound or vibration)', value: -1 },+ { label: 'Normal (0)', value: 0 },+ { label: 'High (1, bypasses quiet hours)', value: 1 },+ { label: 'Emergency (2, repeats until acknowledged)', value: 2 },+ ],+ },+ }),+ retry: Property.Number({+ displayName: 'Retry',+ description:+ 'Emergency priority only. Seconds between repeat deliveries, minimum 30. Pushover stops after 50 retries even if Expire has not elapsed.',+ required: false,+ }),+ expire: Property.Number({+ displayName: 'Expire',+ description:+ 'Emergency priority only. Seconds to keep retrying for, maximum 10800.',+ required: false,+ }),+ ttl: Property.Number({+ displayName: 'Time To Live',+ description:+ 'Seconds after which the notification is auto-deleted from the device. Ignored at emergency priority (2).',+ required: false,+ }),+ sound: Property.Dropdown({+ displayName: 'Sound',+ description:+ 'Notification sound. Leave on the default option to omit the parameter so the recipient device sound applies.',+ required: false,+ auth: pushoverAuth,+ refreshers: [],+ options: async ({ auth }) => {+ if (!auth) {+ return {+ disabled: true,+ placeholder: 'Connect a Pushover account first',+ options: [],+ };+ }+ const response = await pushoverApiCall<{+ sounds: Record<string, string>;+ }>({+ method: HttpMethod.GET,+ resourceUri: '/sounds.json',+ queryParams: { token: auth.props.api_token },+ });+ return {+ disabled: false,+ options: [+ { label: "Device default (don't send a sound)", value: '' },+ ...Object.entries(response.sounds ?? {}).map(+ ([value, label]) => ({ label, value })+ ),+ ],+ };+ },+ }),+ url: Property.ShortText({+ displayName: 'URL',+ description:+ "Supplementary URL shown with the message, for example 'https://status.example.com/incident/42'.",+ required: false,+ }),+ url_title: Property.ShortText({+ displayName: 'URL Title',+ description:+ 'Link text for the supplementary URL. The raw URL is shown when omitted.',+ required: false,+ }),+ device: Property.ShortText({+ displayName: 'Device',+ description:+ "Deliver only to this device name, for example 'iphone'. All devices receive it when omitted.",+ required: false,+ }),+ timestamp: Property.ShortText({+ displayName: 'Timestamp',+ description:+ "Unix timestamp to display instead of the receive time, for example '1767225600'.",+ required: false,+ }),+ html: Property.Checkbox({+ displayName: 'Enable HTML',+ description:+ 'Parse a limited HTML subset in the message. Cannot be combined with Monospace.',+ required: false,+ }),+ monospace: Property.Checkbox({+ displayName: 'Monospace',+ description:+ 'Render the message in a monospace font. Cannot be combined with Enable HTML.',+ required: false,+ }),+ tags: Property.ShortText({+ displayName: 'Tags',+ description:+ "Comma-separated tags stored with an emergency notification, for example 'deploy,prod'. Required upfront if you intend to use Cancel Emergency Retries by Tag.",+ required: false,+ }),+ callback: Property.ShortText({+ displayName: 'Callback URL',+ description:+ 'Emergency priority only. Pushover POSTs to this URL once the notification is acknowledged.',+ required: false,+ }),+ attachment_base64: Property.LongText({+ displayName: 'Attachment (Base64)',+ description:+ 'Base64-encoded image to attach, maximum 5242880 bytes decoded. Requires Attachment Type.',+ required: false,+ }),+ attachment_type: Property.ShortText({+ displayName: 'Attachment Type',+ description:+ "MIME type of the attachment, for example 'image/jpeg'. Required when an attachment is supplied.",+ required: false,+ }),+ },+ outputSchema: sendPushMessageOutputSchema,+ async run({ auth, propsValue }) {+ const body = buildMessageBody({+ apiToken: auth.props.api_token,+ userKey: auth.props.user_key,+ message: propsValue.message,+ title: propsValue.title,+ html: propsValue.html,+ monospace: propsValue.monospace,+ priority: propsValue.priority,+ retry: propsValue.retry,+ expire: propsValue.expire,+ ttl: propsValue.ttl,+ url: propsValue.url,+ urlTitle: propsValue.url_title,+ timestamp: propsValue.timestamp,+ device: propsValue.device,+ sound: propsValue.sound,+ tags: propsValue.tags,+ callback: propsValue.callback,+ attachmentBase64: propsValue.attachment_base64,+ attachmentType: propsValue.attachment_type,+ });++ return await pushoverApiCall({+ method: HttpMethod.POST,+ resourceUri: '/messages.json',+ body,+ });+ },+});diff --git a/packages/pieces/community/pushover/src/lib/actions/update-glance.ts b/packages/pieces/community/pushover/src/lib/actions/update-glance.tsnew file mode 100644index 00000000000..f1cddf4c1e4--- /dev/null+++ b/packages/pieces/community/pushover/src/lib/actions/update-glance.ts@@ -0,0 +1,89 @@+import { createAction, Property } from '@activepieces/pieces-framework';+import { HttpMethod } from '@activepieces/pieces-common';+import { pushoverAuth } from '../..';+import { pushoverApiCall } from '../common';++export const updateGlance = createAction({+ auth: pushoverAuth,+ name: 'update_glance',+ classification: 'WRITE',+ displayName: 'Update Glance Widget',+ description: 'Update the Pushover glance widget fields on the user devices',+ audience: 'ai',+ aiMetadata: {+ description:+ 'Silently update the Pushover glance widget on the recipient devices without sending a notification. Use it for a continuously refreshed status number or line of text, and use Send Push Message when the person should actually be alerted. At least one of title, text, subtext, count or percent is required. Fields persist between calls: omit a field to leave its current value alone. This action only sets field values and cannot clear a field once it has one. A registered widget is required and the Apple Watch is the only supported widget, so a success response on an account without one proves the call shape only. Safe to retry: the same values converge on the same widget state.',+ idempotent: true,+ },+ props: {+ title: Property.ShortText({+ displayName: 'Title',+ description:+ 'Short description of the data, maximum 100 characters. Omit to leave unchanged. Values cannot be cleared once set.',+ required: false,+ }),+ text: Property.ShortText({+ displayName: 'Text',+ description:+ 'Main line of text, maximum 100 characters. Omit to leave unchanged. Values cannot be cleared once set.',+ required: false,+ }),+ subtext: Property.ShortText({+ displayName: 'Subtext',+ description:+ 'Second line of text, maximum 100 characters. Omit to leave unchanged. Values cannot be cleared once set.',+ required: false,+ }),+ count: Property.Number({+ displayName: 'Count',+ description:+ 'Integer shown on the widget, may be negative. Omit to leave unchanged.',+ required: false,+ }),+ percent: Property.Number({+ displayName: 'Percent',+ description:+ 'Integer from 0 to 100 rendered as a progress bar. Omit to leave unchanged.',+ required: false,+ }),+ device: Property.ShortText({+ displayName: 'Device',+ description:+ 'Update only this device name. All devices are updated when omitted.',+ required: false,+ }),+ },+ async run({ auth, propsValue }) {+ const fields = {+ ...(isFilled(propsValue.title) ? { title: propsValue.title } : {}),+ ...(isFilled(propsValue.text) ? { text: propsValue.text } : {}),+ ...(isFilled(propsValue.subtext)+ ? { subtext: propsValue.subtext }+ : {}),+ ...(propsValue.count !== undefined ? { count: propsValue.count } : {}),+ ...(propsValue.percent !== undefined+ ? { percent: propsValue.percent }+ : {}),+ };+ if (Object.keys(fields).length === 0) {+ throw new Error(+ 'Update Glance Widget needs at least one of title, text, subtext, count or percent.'+ );+ }++ return await pushoverApiCall({+ method: HttpMethod.POST,+ resourceUri: '/glances.json',+ body: {+ token: auth.props.api_token,+ user: auth.props.user_key,+ ...fields,+ ...(propsValue.device ? { device: propsValue.device } : {}),+ },+ });+ },+});++function isFilled(value: string | undefined): value is string {+ return value !== undefined && value.length > 0;+}diff --git a/packages/pieces/community/pushover/src/lib/actions/validate-user-key.ts b/packages/pieces/community/pushover/src/lib/actions/validate-user-key.tsnew file mode 100644index 00000000000..e7f4cdf77a8--- /dev/null+++ b/packages/pieces/community/pushover/src/lib/actions/validate-user-key.ts@@ -0,0 +1,51 @@+import { createAction, Property } from '@activepieces/pieces-framework';+import { HttpMethod } from '@activepieces/pieces-common';+import { pushoverAuth } from '../..';+import { pushoverApiCall } from '../common';+import { validateUserKeyOutputSchema } from '../output-schemas';++export const validateUserKey = createAction({+ auth: pushoverAuth,+ name: 'validate_user_key',+ classification: 'READ',+ displayName: 'Validate User or Group Key',+ description: 'Check whether a Pushover user or group key is valid and reachable',+ audience: 'ai',+ aiMetadata: {+ description:+ 'Check before sending whether a user or group key exists, is not disabled, and has at least one active device, returning its device names and licenses. Use it to validate a key handed to you by someone else; leave the key blank to check the key stored on the connection. Read-only despite being a POST: nothing is delivered and nothing changes. Safe to retry.',+ idempotent: true,+ },+ props: {+ user: Property.ShortText({+ displayName: 'User or Group Key',+ description:+ 'The 30-character user or group key to validate. Defaults to the key stored on the connection when left blank.',+ required: false,+ }),+ device: Property.ShortText({+ displayName: 'Device',+ description:+ 'Optional device name to validate alongside the key, for example iphone.',+ required: false,+ }),+ },+ outputSchema: validateUserKeyOutputSchema,+ async run({ auth, propsValue }) {+ const suppliedUser = propsValue.user;+ const user =+ suppliedUser !== undefined && suppliedUser.length > 0+ ? suppliedUser+ : auth.props.user_key;++ return await pushoverApiCall({+ method: HttpMethod.POST,+ resourceUri: '/users/validate.json',+ body: {+ token: auth.props.api_token,+ user,+ ...(propsValue.device ? { device: propsValue.device } : {}),+ },+ });+ },+});diff --git a/packages/pieces/community/pushover/src/lib/common/index.ts b/packages/pieces/community/pushover/src/lib/common/index.tsnew file mode 100644index 00000000000..5a5927a8288--- /dev/null+++ b/packages/pieces/community/pushover/src/lib/common/index.ts@@ -0,0 +1,331 @@+import {+ HttpError,+ HttpMessageBody,+ HttpMethod,+ httpClient,+} from '@activepieces/pieces-common';++export const PUSHOVER_BASE_URL = 'https://api.pushover.net/1';++export const PUSHOVER_MAX_EMERGENCY_RETRIES = 50;+export const PUSHOVER_MIN_RETRY_SECONDS = 30;+export const PUSHOVER_MAX_EXPIRE_SECONDS = 10800;+export const PUSHOVER_MIN_PRIORITY = -2;+export const PUSHOVER_MAX_PRIORITY = 2;+export const PUSHOVER_MAX_ATTACHMENT_BYTES = 5242880;++const MAX_ERROR_DETAIL_LENGTH = 400;++const ERROR_BODY_METADATA_KEYS = new Set(['status', 'request', 'receipt']);++const DATA_URI_PREFIX_PATTERN = /^data:[^;,]*;base64,/;++const WHITESPACE_PATTERN = /\s+/g;++export async function pushoverApiCall<T extends HttpMessageBody>({+ method,+ resourceUri,+ body,+ queryParams,+ errorHint,+}: PushoverApiCallParams): Promise<T> {+ try {+ const response = await httpClient.sendRequest<T>({+ method,+ url: `${PUSHOVER_BASE_URL}${resourceUri}`,+ body,+ queryParams,+ });+ return response.body;+ } catch (error) {+ throw new PushoverRequestError({+ message: describePushoverError({ error, errorHint }),+ status: error instanceof HttpError ? error.response.status : undefined,+ vendorErrors:+ error instanceof HttpError+ ? collectVendorErrors(error.response.body)+ : [],+ responseBody:+ error instanceof HttpError ? error.response.body : undefined,+ });+ }+}++export function buildMessageBody({+ apiToken,+ userKey,+ title,+ message,+ html,+ monospace,+ priority,+ retry,+ expire,+ ttl,+ url,+ urlTitle,+ timestamp,+ device,+ sound,+ tags,+ callback,+ attachmentBase64,+ attachmentType,+}: BuildMessageBodyParams): Record<string, unknown> {+ if (html === true && monospace === true) {+ throw new Error(+ 'Pushover rejects html and monospace together: choose one message formatting mode.'+ );+ }+ const priorityNumber = isPresent(priority) ? Number(priority) : undefined;+ if (priorityNumber !== undefined && Number.isNaN(priorityNumber)) {+ throw new Error(+ `Priority must be a number between ${PUSHOVER_MIN_PRIORITY} and ${PUSHOVER_MAX_PRIORITY}.`+ );+ }+ if (+ priorityNumber !== undefined &&+ (priorityNumber < PUSHOVER_MIN_PRIORITY ||+ priorityNumber > PUSHOVER_MAX_PRIORITY)+ ) {+ throw new Error(+ `Priority must be a number between ${PUSHOVER_MIN_PRIORITY} and ${PUSHOVER_MAX_PRIORITY}.`+ );+ }+ if (priorityNumber === 2) {+ if (!isPresent(retry) || !isPresent(expire)) {+ throw new Error(+ `Emergency priority (2) requires both retry (>= ${PUSHOVER_MIN_RETRY_SECONDS} seconds) and expire (<= ${PUSHOVER_MAX_EXPIRE_SECONDS} seconds).`+ );+ }+ if (retry < PUSHOVER_MIN_RETRY_SECONDS) {+ throw new Error(+ `Emergency priority (2) requires retry to be at least ${PUSHOVER_MIN_RETRY_SECONDS} seconds.`+ );+ }+ if (expire < 1 || expire > PUSHOVER_MAX_EXPIRE_SECONDS) {+ throw new Error(+ `Emergency priority (2) requires expire between 1 and ${PUSHOVER_MAX_EXPIRE_SECONDS} seconds.`+ );+ }+ }+ if (isPresent(attachmentBase64) && !isPresent(attachmentType)) {+ throw new Error(+ 'attachment_type (for example image/jpeg) is required whenever an attachment is supplied.'+ );+ }+ if (+ isPresent(attachmentBase64) &&+ decodedBase64ByteLength(attachmentBase64) > PUSHOVER_MAX_ATTACHMENT_BYTES+ ) {+ throw new Error(+ `The attachment decodes to more than the Pushover limit of ${PUSHOVER_MAX_ATTACHMENT_BYTES} bytes (5 MB). Resize or recompress the image before sending.`+ );+ }++ return {+ token: apiToken,+ user: userKey,+ message,+ ...spreadWhenPresent({ title }),+ ...spreadWhenPresent({ url }),+ ...spreadWhenPresent({ url_title: urlTitle }),+ ...spreadWhenPresent({ timestamp }),+ ...spreadWhenPresent({ device }),+ ...spreadWhenPresent({ callback }),+ ...spreadWhenPresent({ tags }),+ ...spreadWhenPresent({ sound }),+ ...spreadWhenPresent({ attachment_base64: attachmentBase64 }),+ ...spreadWhenPresent({ attachment_type: attachmentType }),+ ...(html === true ? { html: 1 } : {}),+ ...(monospace === true ? { monospace: 1 } : {}),+ ...(priorityNumber !== undefined ? { priority: priorityNumber } : {}),+ ...(priorityNumber === 2 ? { retry, expire } : {}),+ ...(priorityNumber !== 2 && isPresent(ttl) ? { ttl } : {}),+ };+}++function decodedBase64ByteLength(attachmentBase64: string): number {+ const payload = attachmentBase64+ .replace(DATA_URI_PREFIX_PATTERN, '')+ .replace(WHITESPACE_PATTERN, '');+ const paddingLength = payload.endsWith('==')+ ? 2+ : payload.endsWith('=')+ ? 1+ : 0;+ return Math.floor((payload.length * 3) / 4) - paddingLength;+}++function isPresent<T>(value: T | undefined | null): value is T {+ if (value === undefined || value === null) {+ return false;+ }+ return typeof value === 'string' ? value.length > 0 : true;+}++function spreadWhenPresent(+ entry: Record<string, unknown>+): Record<string, unknown> {+ return Object.fromEntries(+ Object.entries(entry).filter(([, value]) => isPresent(value))+ );+}++function truncateDetail(detail: string): string {+ return detail.length > MAX_ERROR_DETAIL_LENGTH+ ? `${detail.slice(0, MAX_ERROR_DETAIL_LENGTH)}...`+ : detail;+}++function flattenErrorValue(value: unknown): string[] {+ if (typeof value === 'string') {+ return value.trim().length > 0 ? [value.trim()] : [];+ }+ if (typeof value === 'number' || typeof value === 'boolean') {+ return [String(value)];+ }+ if (Array.isArray(value)) {+ return value.flatMap(flattenErrorValue);+ }+ if (typeof value === 'object' && value !== null) {+ return Object.entries(value).flatMap(([key, nested]) =>+ flattenErrorValue(nested).map((entry) => `${key}: ${entry}`)+ );+ }+ return [];+}++function collectVendorErrors(body: unknown): string[] {+ if (typeof body === 'string') {+ const trimmed = body.trim();+ return trimmed.length > 0 ? [trimmed] : [];+ }+ if (typeof body !== 'object' || body === null) {+ return [];+ }+ const listedErrors = flattenErrorValue(+ 'errors' in body ? body.errors : undefined+ );+ const fieldErrors = Object.entries(body)+ .filter(([key]) => key !== 'errors' && !ERROR_BODY_METADATA_KEYS.has(key))+ .flatMap(([key, value]) =>+ flattenErrorValue(value).map((entry) => `${key}: ${entry}`)+ );+ return [...listedErrors, ...fieldErrors];+}++function readVendorErrors(body: unknown): string {+ if (typeof body === 'string') {+ const trimmed = body.trim();+ return trimmed.length > 0+ ? ` Pushover said: ${truncateDetail(trimmed)}.`+ : '';+ }+ if (typeof body !== 'object' || body === null) {+ return '';+ }++ const listedErrors = flattenErrorValue(+ 'errors' in body ? body.errors : undefined+ );+ const fieldErrors = Object.entries(body)+ .filter(([key]) => key !== 'errors' && !ERROR_BODY_METADATA_KEYS.has(key))+ .flatMap(([key, value]) =>+ typeof value === 'string' && value.trim().length > 0+ ? [`${key}: ${value.trim()}`]+ : []+ );+ const messages = [...listedErrors, ...fieldErrors];+ if (messages.length > 0) {+ return ` Pushover said: ${truncateDetail(messages.join('; '))}.`;+ }++ return ` Pushover returned this body: ${truncateDetail(JSON.stringify(body))}.`;+}++function describePushoverError({+ error,+ errorHint,+}: DescribeErrorParams): string {+ const hint = isPresent(errorHint) ? ` ${errorHint}` : '';+ if (!(error instanceof HttpError)) {+ return error instanceof Error ? error.message : String(error);+ }+ const status = error.response.status;+ const vendorErrors = readVendorErrors(error.response.body);+ if (status === 429) {+ return `Pushover returned 429: the application monthly message quota is exhausted, not a transient rate limit. Check Get Monthly Message Limits for the reset date.${vendorErrors}`;+ }+ if (status >= 500) {+ return `Pushover returned ${status}. This class is retryable, but wait at least 5 seconds before trying again.${vendorErrors}`;+ }+ if (status >= 400) {+ return `Pushover returned ${status}. 4xx responses are terminal: retrying the same request will fail again, and repeated bad requests can get the IP temporarily blocked. Fix the input first.${hint}${vendorErrors}`;+ }+ return `Pushover request failed with status ${status}.${vendorErrors}`;+}++export class PushoverRequestError extends Error {+ readonly status: number | undefined;+ readonly vendorErrors: string[];+ readonly responseBody: unknown;++ constructor({+ message,+ status,+ vendorErrors,+ responseBody,+ }: PushoverRequestErrorParams) {+ super(message);+ this.name = 'PushoverRequestError';+ this.status = status;+ this.vendorErrors = vendorErrors;+ this.responseBody = responseBody;+ }+}++export const GROUP_OWNERSHIP_HINT =+ 'The Groups API requires the application token to belong to the same account that owns the group, so an ownership mismatch reports the same way as an unknown group key.';++export type PushoverApiCallParams = {+ method: HttpMethod;+ resourceUri: string;+ body?: Record<string, unknown>;+ queryParams?: Record<string, string>;+ errorHint?: string;+};++export type BuildMessageBodyParams = {+ apiToken: string;+ userKey: string;+ message: string;+ title?: string;+ html?: boolean;+ monospace?: boolean;+ priority?: number | string;+ retry?: number;+ expire?: number;+ ttl?: number;+ url?: string;+ urlTitle?: string;+ timestamp?: string;+ device?: string;+ sound?: string;+ tags?: string;+ callback?: string;+ attachmentBase64?: string;+ attachmentType?: string;+};++export type DescribeErrorParams = {+ error: unknown;+ errorHint?: string;+};++export type PushoverRequestErrorParams = {+ message: string;+ status: number | undefined;+ vendorErrors: string[];+ responseBody: unknown;+};diff --git a/packages/pieces/community/pushover/src/lib/output-schemas.ts b/packages/pieces/community/pushover/src/lib/output-schemas.tsindex 742de019e78..0f1c479a6e6 100644--- a/packages/pieces/community/pushover/src/lib/output-schemas.ts+++ b/packages/pieces/community/pushover/src/lib/output-schemas.ts@@ -24,3 +24,470 @@ export const sendNotificationActionOutputSchema: OutputSchema = {},],};++export const sendPushMessageOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'status',+ label: 'Status',+ format: 'number',+ description: '1 when Pushover accepted the notification. Any other value means it was rejected.',+ },+ {+ key: 'request',+ label: 'Request ID',+ description: 'Pushover\'s identifier for this request, worth quoting when reporting a delivery problem.',+ },+ {+ key: 'receipt',+ label: 'Receipt',+ description:+ 'Only returned at emergency priority (2). Pass it to Get Emergency Receipt Status or Cancel Emergency Retries.',+ },+ ],+};++export const getAppLimitsOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'limit',+ label: 'Monthly Limit',+ format: 'number',+ description: 'Total messages the application may send this month.',+ },+ {+ key: 'remaining',+ label: 'Remaining',+ format: 'number',+ description:+ 'Messages still available before the monthly quota is exhausted and sends start returning 429.',+ },+ {+ key: 'reset',+ label: 'Quota Reset',+ format: 'number',+ description: 'Unix timestamp in seconds at which the monthly counter resets.',+ },+ {+ key: 'status',+ label: 'Status',+ format: 'number',+ description: '1 when Pushover accepted the request.',+ },+ {+ key: 'request',+ label: 'Request ID',+ description: 'Pushover\'s identifier for this request, worth quoting when reporting a problem.',+ },+ ],+};++export const listNotificationSoundsOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'sounds',+ label: 'Sounds',+ labelKey: 'name',+ description: 'Every sound Pushover accepts for the Sound parameter of Send Push Message.',+ listItems: [+ {+ key: 'id',+ label: 'Sound ID',+ description: 'Identifier to pass as the Sound parameter, for example pushover or cosmic.',+ },+ {+ key: 'name',+ label: 'Name',+ description: 'Human-readable sound name, for example Pushover (default).',+ },+ ],+ },+ {+ key: 'count',+ label: 'Count',+ format: 'number',+ description: 'Number of sounds returned.',+ },+ {+ key: 'status',+ label: 'Status',+ format: 'number',+ description: '1 when Pushover accepted the request.',+ },+ {+ key: 'request',+ label: 'Request ID',+ description: 'Pushover\'s identifier for this request.',+ },+ ],+};++export const listDeliveryGroupsOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'groups',+ label: 'Groups',+ labelKey: 'name',+ description: 'Delivery groups owned by the same account as the application token.',+ listItems: [+ {+ key: 'group',+ label: 'Group Key',+ description: 'The 30-character group key every other group action takes as input.',+ },+ {+ key: 'name',+ label: 'Name',+ description: 'Group name, unique within the account.',+ },+ ],+ },+ {+ key: 'count',+ label: 'Count',+ format: 'number',+ description: 'Number of groups returned.',+ },+ {+ key: 'status',+ label: 'Status',+ format: 'number',+ description: '1 when Pushover accepted the request.',+ },+ {+ key: 'request',+ label: 'Request ID',+ description: 'Pushover\'s identifier for this request.',+ },+ ],+};++export const getDeliveryGroupOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'name',+ label: 'Name',+ description: 'Name of the delivery group.',+ },+ {+ key: 'users',+ label: 'Members',+ labelKey: 'user',+ description: 'Every member of the group, including members currently suspended.',+ listItems: [+ {+ key: 'user',+ label: 'User Key',+ description:+ 'The 30-character user key of the member, as passed to Remove User from Delivery Group, Disable Group User and Enable Group User.',+ },+ {+ key: 'device',+ label: 'Device',+ description:+ 'Device the group delivers to for this member, or null when every device of theirs receives group messages.',+ },+ {+ key: 'memo',+ label: 'Memo',+ description: 'Note stored with the membership, for example Primary on-call.',+ },+ {+ key: 'disabled',+ label: 'Disabled',+ format: 'boolean',+ description:+ 'True while the member is suspended by Disable Group User and group messages skip them. Restore with Enable Group User.',+ },+ {+ key: 'valid',+ label: 'Valid',+ format: 'boolean',+ description:+ 'False when the user key is no longer reachable, for example because the account was deleted or has no active device.',+ },+ ],+ },+ {+ key: 'status',+ label: 'Status',+ format: 'number',+ description: '1 when Pushover accepted the request.',+ },+ {+ key: 'request',+ label: 'Request ID',+ description: 'Pushover\'s identifier for this request.',+ },+ ],+};++export const getLicenseCreditsOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'credits',+ label: 'Credits',+ format: 'number',+ description:+ 'Prepaid license credits the application still holds. Assign License spends one irreversibly.',+ },+ {+ key: 'status',+ label: 'Status',+ format: 'number',+ description: '1 when Pushover accepted the request.',+ },+ {+ key: 'request',+ label: 'Request ID',+ description: 'Pushover\'s identifier for this request.',+ },+ ],+};++export const validateUserKeyOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'status',+ label: 'Status',+ format: 'number',+ description: '1 when the key is valid, has at least one active device and is not disabled.',+ },+ {+ key: 'group',+ label: 'Is Group',+ format: 'number',+ description: '1 when the validated key is a delivery group key, 0 when it is a user key.',+ },+ {+ key: 'devices',+ label: 'Devices',+ description:+ 'Names of the devices registered to this user, usable as the Device parameter of Send Push Message.',+ },+ {+ key: 'licenses',+ label: 'Licenses',+ description: 'Platforms the user holds a license for, for example Android or iOS.',+ },+ {+ key: 'request',+ label: 'Request ID',+ description: 'Pushover\'s identifier for this request.',+ },+ ],+};++export const createDeliveryGroupOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'group',+ label: 'Group Key',+ description: 'The 30-character group key, whether the group was created or already existed.',+ },+ {+ key: 'name',+ label: 'Name',+ description: 'Name of the group.',+ },+ {+ key: 'created',+ label: 'Created',+ format: 'boolean',+ description:+ 'True when a new group was created, false when an existing group with that name was returned.',+ },+ ],+};++export const renameDeliveryGroupOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'status',+ label: 'Status',+ format: 'number',+ description: '1 when Pushover renamed the group.',+ },+ {+ key: 'request',+ label: 'Request ID',+ description: 'Pushover\'s identifier for this request.',+ },+ ],+};++export const getReceiptStatusOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'status',+ label: 'Status',+ format: 'number',+ description: '1 when Pushover accepted the request.',+ },+ {+ key: 'acknowledged',+ label: 'Acknowledged',+ format: 'number',+ description:+ '1 once a recipient acknowledged the emergency notification, which stops the retries.',+ },+ {+ key: 'acknowledged_at',+ label: 'Acknowledged At',+ format: 'number',+ description: 'Unix timestamp in seconds of the acknowledgement, 0 while unacknowledged.',+ },+ {+ key: 'acknowledged_by',+ label: 'Acknowledged By',+ description: 'User key of the recipient who acknowledged, empty while unacknowledged.',+ },+ {+ key: 'acknowledged_by_device',+ label: 'Acknowledged By Device',+ description: 'Device name that acknowledged, empty while unacknowledged.',+ },+ {+ key: 'last_delivered_at',+ label: 'Last Delivered At',+ format: 'number',+ description: 'Unix timestamp in seconds of the most recent retry delivery.',+ },+ {+ key: 'expired',+ label: 'Expired',+ format: 'number',+ description: '1 once the retry window closed without an acknowledgement.',+ },+ {+ key: 'expires_at',+ label: 'Expires At',+ format: 'number',+ description: 'Unix timestamp in seconds at which retrying stops.',+ },+ {+ key: 'called_back',+ label: 'Called Back',+ format: 'number',+ description: '1 once Pushover called the callback URL supplied at send time.',+ },+ {+ key: 'called_back_at',+ label: 'Called Back At',+ format: 'number',+ description: 'Unix timestamp in seconds of the callback, 0 when no callback fired.',+ },+ {+ key: 'request',+ label: 'Request ID',+ description: 'Pushover\'s identifier for this request.',+ },+ ],+};++export const cancelEmergencyRetriesOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'status',+ label: 'Status',+ format: 'number',+ description: '1 when the retry loop for this receipt is stopped.',+ },+ {+ key: 'request',+ label: 'Request ID',+ description: 'Pushover\'s identifier for this request.',+ },+ ],+};++export const cancelEmergencyRetriesByTagOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'status',+ label: 'Status',+ format: 'number',+ description: '1 when Pushover accepted the request.',+ },+ {+ key: 'canceled',+ label: 'Canceled Count',+ format: 'number',+ description:+ 'Number of still-retrying emergency notifications carrying the tag that were stopped.',+ },+ {+ key: 'request',+ label: 'Request ID',+ description: 'Pushover\'s identifier for this request.',+ },+ ],+};++export const addUserToGroupOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'status',+ label: 'Status',+ format: 'number',+ description:+ '1 when the user was added as a member. Adding someone who is already a member fails instead of returning a non-1 status.',+ },+ {+ key: 'request',+ label: 'Request ID',+ description: 'Pushover\'s identifier for this request.',+ },+ ],+};++export const removeUserFromGroupOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'status',+ label: 'Status',+ format: 'number',+ description:+ '1 when the member was removed. Removing someone who is not a member fails instead of returning a non-1 status.',+ },+ {+ key: 'request',+ label: 'Request ID',+ description: 'Pushover\'s identifier for this request.',+ },+ ],+};++export const disableGroupUserOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'status',+ label: 'Status',+ format: 'number',+ description:+ '1 when the member is suspended. Read the membership back with Get Delivery Group to see disabled turn true.',+ },+ {+ key: 'request',+ label: 'Request ID',+ description: 'Pushover\'s identifier for this request.',+ },+ ],+};++export const enableGroupUserOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'status',+ label: 'Status',+ format: 'number',+ description:+ '1 when the member receives group messages again. Read the membership back with Get Delivery Group to see disabled turn false.',+ },+ {+ key: 'request',+ label: 'Request ID',+ description: 'Pushover\'s identifier for this request.',+ },+ ],+};