Hello, i have so many errors with my custom code to connect a dialer tool (Diabolocom) and i don't understand why : Could you please help me ?
import os
from hubspot import HubSpot
from hubspot.crm.contacts import ApiException
import requests
import json
import re
def main(event):
JN_HUBSPOT_API_KEY = "MY_KEY"
hubspot = HubSpot(api_key=JN_HUBSPOT_API_KEY)
try:
ApiResponse = hubspot.crm.contacts.basic_api.get_by_id('contact_id')
phone=ApiResponse.properties.get('phone')
phone = re.sub("^0(.*)",r"33\1",phone)
phone=phone.replace(" ","")
hs_object_id=ApiResponse.properties.get('hs_object_id')
except ApiException as e:
diabolocom_api_endpoint = "URL"
headers = {
'Private-Token': TOKEN_DIABOLO',
'Content-Type': 'application/json'
}
payload = json.dumps({
"priority": 10,
"customFields": {
"phone": phone,
"nom": lastname,
"prenom": firstname,
"fp_campagne": fp___campagne,
"id_contact": id_contact
}
})
r=requests.post(diabolocom_api_endpoint, headers=headers, data=payload)
Hello, i have so many errors with my custom code to connect a dialer tool (Diabolocom) and i don't understand why : Could you please help me ?
import os
from hubspot import HubSpot
from hubspot.crm.contacts import ApiException
import requests
import json
import re
def main(event):
JN_HUBSPOT_API_KEY = "MY_KEY"
hubspot = HubSpot(api_key=JN_HUBSPOT_API_KEY)
try:
except ApiException as e:
diabolocom_api_endpoint = "URL"
headers = {
payload = json.dumps({
r=requests.post(diabolocom_api_endpoint, headers=headers, data=payload)