Discussions

Ask a Question
Back to All

message post success, but unresponsive

I am using "add message to booking " via

https://api.lodgify.com/v1/reservation/booking/{id}/messages

where id is a reservation ID in the future. I am the both the guest and the owner of this reservation. The python code is below.

The "response" returned is a success code of 200, however no message appears in the string and I receive no email as the guest (email is specified in the reservation).

Importantly, the developer document's "Try it" button also results in a code 200 AND places the message in the string and produces an email for me as the guest.

I am at a loss as to why my code generates a success code while not actually producing the message as expected.

def LSend(subject, message,typem,idn,sn='true'):
idn = str(idn)
url = "https://api.lodgify.com/v1/reservation/booking/"+idn+"/messages"
payload = "[{"subject":subject,"message":message,"type":typem,"send_notification":sn}]"
headers = {
"accept": "application/json",
"content-type": "application/*+json",
"X-ApiKey": "MYKEYHERE"
}
response = requests.post(url, data=payload, headers=headers)
print(response.text)
return response

response=LSend(subject='from script',message='Please send this test message.t',typem='Owner',idn=MYIDHERE)