1a. Explanation of Python Code Step
import requests
api_key = # 'input your API key here'
url = 'https://app.maax.ai/api/v2/outgoing-messages/'
headers = {
'2hd-api-key': api_key
}
service_type = # 'customer_support_automation' or 'sales_automation'
platform = # 'email, 'website, or 'sms'
ai_id = # 'input your ai id here'
followup_url = # 'input your followup webhook url here'
send_response_url = # 'input your followup webhook url here'
message_content = input_data['message']
phone_number = input_data.get('phone', '')
first_name = input_data.get('first_name', 'unknown')
data = {
'service_type': service_type,
'platform': platform,
'ai_id': ai_id,
'followup_url': followup_url,
'send_response_url': send_response_url,
'message_content': message_content,
'prospect_info': {
'phone': phone_number,
'first_name': first_name
}
}
# POST request
try:
response = requests.post(url, json=data, headers=headers)
response.raise_for_status()
output = [response.json()]
except requests.exceptions.RequestException as e:
error_message = str(e)
output = {"error": error_message}Summary
Last updated