def METHOD_NAME(self, template_id, user_ids, dept_ids, data):
    body = {
        'agent_id': self._agentid,
        'template_id': template_id,
        'userid_list': ','.join(user_ids),
        'dept_id_list': ','.join(dept_ids),
        'data': data
    }
    data = self._request.post(URL.SEND_MESSAGE_BY_TEMPLATE, json=body, with_token=True)
    return data