def send_message(self, message='', **kwargs):
    'Send some message.'
    payload = {'access_token': self.page_access_token}
    targets = kwargs.get(ATTR_TARGET)
    data = kwargs.get(ATTR_DATA)
    body_message = {'text': message}
    if (data is not None):
        body_message.update(data)
        if ('attachment' in body_message):
            body_message.pop('text')
    if (not targets):
        _LOGGER.error('At least 1 target is required')
        return
    for target in targets:
        if target.startswith('+'):
            recipient = {'phone_number': target}
        else:
            recipient = {'id': target}
        body = {'recipient': recipient, 'message': body_message}
        import json
        resp = requests.post(BASE_URL, data=json.dumps(body), params=payload, headers={CONTENT_TYPE: CONTENT_TYPE_JSON}, timeout=10)
        if (resp.status_code != 200):
            obj = resp.json()
            error_message = obj['error']['message']
            error_code = obj['error']['code']
            _LOGGER.error('Error %s : %s (Code %s)', resp.status_code, error_message, error_code)
Send some message.
def send_message(self, message=, **kwargs):
    
    payload = {'access_token': self.page_access_token}
    targets = kwargs.get(ATTR_TARGET)
    data = kwargs.get(ATTR_DATA)
    body_message = {'text': message}
    if (data is not None):
        body_message.update(data)
        if ('attachment' in body_message):
            body_message.pop('text')
    if (not targets):
        _LOGGER.error('At least 1 target is required')
        return
    for target in targets:
        if target.startswith('+'):
            recipient = {'phone_number': target}
        else:
            recipient = {'id': target}
        body = {'recipient': recipient, 'message': body_message}
        import json
        resp = requests.post(BASE_URL, data=json.dumps(body), params=payload, headers={CONTENT_TYPE: CONTENT_TYPE_JSON}, timeout=10)
        if (resp.status_code != 200):
            obj = resp.json()
            error_message = obj['error']['message']
            error_code = obj['error']['code']
            _LOGGER.error('Error %s : %s (Code %s)', resp.status_code, error_message, error_code)