I have a problem with sending sms from odoo to mobile number. here the console print the message but the message not sending in mobile number. Please help me how can I send message from button action in odoo. Please help
def get_api_key(self, url='', username='', password=''):
if not url:
url = 'http://bulksms.skill.jobs/getkey'
if not username:
username = 'C2006884'
if not password:
password = 'Opx596XTtV'
r = requests.get(url="{url}/{username}/{password}".format(url=url, username=username, password=password))
api_key = r.text.split(':')[1]
print(api_key)
return api_key
def send_sms(self, api_endpoint='', senderid='', **kw):
if not api_endpoint:
api_endpoint = "https://bulksms.skill.jobs/smsapi"
if not senderid:
senderid = "8809612436715"
mobile = self.restaurant_id.mobile
message = "{customer_name} has sent a reservation in {restaurant_name} on . Please call {customer_mobile} for further info.".format(
customer_name=self.customer_id.name,
restaurant_name=self.restaurant_id.name,
# date_and_time=self.time.strftime("%d %B %Y at %I:%M:%S %p"),
customer_mobile=self.customer_id.mobile,
)
params = {
"api_key": self.get_api_key(),
"type": "text",
"contacts": mobile,
"senderid": senderid,
"msg": message
}
r = requests.post(url=api_endpoint, data=params)
self.state = 'sent'
print(r)
print(params)
return True