Edits history of script submission #13569 for ' Submit Verification Request (telnyx)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    type Telnyx = {
    	apiKey: string
    }
    /**
     * Submit Verification Request
     * Submit a new tollfree verification request
     */
    export async function main(
    	auth: Telnyx,
    	body: {
    		businessName: string
    		corporateWebsite: string
    		businessAddr1: string
    		businessAddr2?: string
    		businessCity: string
    		businessState: string
    		businessZip: string
    		businessContactFirstName: string
    		businessContactLastName: string
    		businessContactEmail: string
    		businessContactPhone: string
    		messageVolume:
    			| '10'
    			| '100'
    			| '1,000'
    			| '10,000'
    			| '100,000'
    			| '250,000'
    			| '500,000'
    			| '750,000'
    			| '1,000,000'
    			| '5,000,000'
    			| '10,000,000+'
    		phoneNumbers: { phoneNumber: string }[]
    		useCase:
    			| '2FA'
    			| 'App Notifications'
    			| 'Appointments'
    			| 'Auctions'
    			| 'Auto Repair Services'
    			| 'Bank Transfers'
    			| 'Billing'
    			| 'Booking Confirmations'
    			| 'Business Updates'
    			| 'COVID-19 Alerts'
    			| 'Career Training'
    			| 'Chatbot'
    			| 'Conversational / Alerts'
    			| 'Courier Services & Deliveries'
    			| 'Emergency Alerts'
    			| 'Events & Planning'
    			| 'Financial Services'
    			| 'Fraud Alerts'
    			| 'Fundraising'
    			| 'General Marketing'
    			| 'General School Updates'
    			| 'HR / Staffing'
    			| 'Healthcare Alerts'
    			| 'Housing Community Updates'
    			| 'Insurance Services'
    			| 'Job Dispatch'
    			| 'Legal Services'
    			| 'Mixed'
    			| 'Motivational Reminders'
    			| 'Notary Notifications'
    			| 'Order Notifications'
    			| 'Political'
    			| 'Public Works'
    			| 'Real Estate Services'
    			| 'Religious Services'
    			| 'Repair and Diagnostics Alerts'
    			| 'Rewards Program'
    			| 'Surveys'
    			| 'System Alerts'
    			| 'Voting Reminders'
    			| 'Waitlist Alerts'
    			| 'Webinar Reminders'
    			| 'Workshop Alerts'
    		useCaseSummary: string
    		productionMessageContent: string
    		optInWorkflow: string
    		optInWorkflowImageURLs: { url: string }[]
    		additionalInformation: string
    		isvReseller: string
    		webhookUrl?: string
    	}
    ) {
    	const url = new URL(`https://api.telnyx.com/v2/messaging_tollfree/verification/requests`)
    
    	const response = await fetch(url, {
    		method: 'POST',
    		headers: {
    			'Content-Type': 'application/json',
    			Authorization: 'Bearer ' + auth.apiKey
    		},
    		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 428 days ago