update_activity_schedule
Modify start and end times for Adobe Target activities using tenant-specific scheduling parameters to control campaign timing.
Instructions
Update the activity schedule in Adobe Target.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tenant | Yes | The tenant identifier. | |
| startsAt | Yes | The start time of the activity in ISO 8601 format. | |
| endsAt | Yes | The end time of the activity in ISO 8601 format. |
Implementation Reference
- The main handler function `executeFunction` that performs the HTTP PUT request to the Adobe Target API to update the activity schedule.const executeFunction = async ({ tenant, startsAt, endsAt }) => { const baseUrl = 'https://mc.adobe.io'; const token = process.env.ADOBE_API_KEY; const apiKey = process.env.ADOBE_API_KEY; try { // Construct the URL for the request const url = `${baseUrl}/${tenant}/target/activities/ab/168816/schedule`; // Set up headers for the request const headers = { 'Authorization': `Bearer ${token}`, 'X-Api-Key': apiKey, 'Content-Type': 'application/vnd.adobe.target.v1+json' }; // Prepare the body of the request const body = JSON.stringify({ startsAt, endsAt }); // Perform the fetch request const response = await fetch(url, { method: 'PUT', headers, body }); // Check if the response was successful if (!response.ok) { const errorData = await response.json(); throw new Error(errorData); } // Parse and return the response data const data = await response.json(); return data; } catch (error) { console.error('Error updating activity schedule:', error); return { error: 'An error occurred while updating the activity schedule.' }; } };
- JSON Schema defining the required input parameters for the tool: tenant (string), startsAt (ISO 8601 string), endsAt (ISO 8601 string).type: 'object', properties: { tenant: { type: 'string', description: 'The tenant identifier.' }, startsAt: { type: 'string', description: 'The start time of the activity in ISO 8601 format.' }, endsAt: { type: 'string', description: 'The end time of the activity in ISO 8601 format.' } }, required: ['tenant', 'startsAt', 'endsAt'] }
- lib/tools.js:7-16 (registration)The `discoverTools` function dynamically imports the apiTool from each file in toolPaths (including this tool's file), spreading its properties to register the tool.export async function discoverTools() { const toolPromises = toolPaths.map(async (file) => { const module = await import(`../tools/${file}`); return { ...module.apiTool, path: file, }; }); return Promise.all(toolPromises); }
- tools/paths.js:4-4 (helper)The path to this tool's implementation file, listed in the toolPaths array used by discoverTools for registration.'adobe/adobe-target-admin-ap-is/update-activity-schedule.js'