Initialize outbound call

Initialize Outbound Call Endpoint

Overview

This API endpoint is designed to initialize an outbound call and execute the OTP flow.

Endpoint Details

  • URL: https://oxhkwywu00.execute-api.us-east-1.amazonaws.com/production/outbound/otp/initializecall
  • Method: POST
  • Format: JSON

Request JSON Format

{
  "insuranceType": "string",
  "customerName": "string",
  "paymentAmount": "string",
  "coveragePeriod": "string",
  "destinationPhoneNumber": "string"
}

Parameters:

  • insuranceType: Type of insurance (e.g., "desempleo").
  • customerName: Customer's name (preferably a single name).
  • paymentAmount: Amount (numeric value only).
  • coveragePeriod: Insurance coverage period (e.g., "1 semana", "1 mes").
  • destinationPhoneNumber: Customer's phone number, starting with the country code (e.g., "+578443804581").

Example:

{
  "insuranceType": "desempleo",
  "customerName": "Daniel",
  "paymentAmount": "6500",
  "coveragePeriod": "12 meses",
  "destinationPhoneNumber": "+578443804581"
}

Headers:

  • Key: x-api-key
  • Value: [your-api-key]

Response:

The API will return a JSON response containing metadata and a ContactId. The ContactId is crucial as it will be used to call another API endpoint to retrieve call information.

{
	"$metadata": {
		"httpStatusCode": 200,
		"requestId": "f8feddbe-9008-4265-9b83-eaa155187f62",
		"attempts": 1,
		"totalRetryDelay": 0
	},
	"ContactId": "46fa54ef-0f38-4437-b46e-e8619881c3d3"
}

Code Examples:

JavaScript:

const fetch = require('node-fetch');
 
const data = {
  insuranceType: "desempleo",
  customerName: "Daniel",
  paymentAmount: "6500",
  coveragePeriod: "12 meses",
  destinationPhoneNumber: "+578443804581"
};
 
fetch('https://oxhkwywu00.execute-api.us-east-1.amazonaws.com/production/outbound/otp/initializecall', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'x-api-key': 'mtgD8t0fav3xziGJmP1FyevXDAlafcc3QRmBwWP08'
  },
  body: JSON.stringify(data)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));

Python:

import requests
 
url = "https://oxhkwywu00.execute-api.us-east-1.amazonaws.com/production/outbound/otp/initializecall"
headers = {
    "Content-Type": "application/json",
    "x-api-key": "mtgD8t0fav3xziGJmP1FyevXDAlafcc3QRmBwWP08"
}
data = {
    "insuranceType": "desempleo",
    "customerName": "Daniel",
    "paymentAmount": "6500",
    "coveragePeriod": "12 meses",
    "destinationPhoneNumber": "+578443804581"
}
 
response = requests.post(url, headers=headers, json=data)
print(response.json())

cURL:

curl -X POST \
  https://oxhkwywu00.execute-api.us-east-1.amazonaws.com/production/outbound/otp/initializecall \
  -H 'Content-Type: application/json' \
  -H 'x-api-key: mtgD8t0fav3xziGJmP1FyevXDAlafcc3QRmBwWP08' \
  -d '{
    "insuranceType": "desempleo",
    "customerName": "Daniel",
    "paymentAmount": "6500",
    "coveragePeriod": "12 meses",
    "destinationPhoneNumber": "+578443804581"
}'

We hope this documentation provides clarity on how to use the "Initialize Outbound Call" endpoint. If you have any questions or need further assistance, please don't hesitate to contact us.