Edits history of script submission #9765 for ' Updates data associated with user (actimo)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    type Actimo = {
    	apiKey: string
    }
    
    export async function main(
    	auth: Actimo,
    	body: {
    		country_code?: string
    		default_group_id?: number
    		default_theme_id?: number
    		delivery_preference?: string
    		department?: string
    		email?: string
    		favourite_group_id?: number
    		first_name?: string
    		force_sms?: number
    		last_name?: string
    		list_settings?: {}
    		locale?: string
    		phone_number?: string
    		preferences?: {}
    		setting_message_channel_email_from_address_default?: string
    		setting_message_channel_email_from_name_default?: string
    		setting_message_channel_sms_from_name_default?: string
    		setting_message_channel_sms_msg_template_default?: string
    		setting_send_reminders_default?: false | true
    		test_phone_number?: string
    		test_phone_number_code?: string
    		ui_view_settings?: string
    		webhook_message_event_url?: string
    	}
    ) {
    	const url = new URL(`https://actimo.com/api/v1/account/user`)
    
    	const response = await fetch(url, {
    		method: 'PUT',
    		headers: {
    			'api-key': auth.apiKey,
    			'Content-Type': 'application/json'
    		},
    		body: JSON.stringify(body)
    	})
    
    	if (!response.ok) {
    		const text = await response.text()
    		throw new Error(`${response.status} ${text}`)
    	}
    
    	return await response.json()
    }
    

    Submitted by hugo697 572 days ago