Upgrade to Pro — share decks privately, control downloads, hide ads and more …

PythonでSlack Bot

anonaka
March 18, 2017

PythonでSlack Bot

SlackBot sample to make a phone call and read text.

anonaka

March 18, 2017
Tweet

More Decks by anonaka

Other Decks in Technology

Transcript

  1. $ cat slack.py # -*- coding: utf-8 -*- import os

    from slackbot.bot import respond_to, listen_to from xoxzo.cloudpy import XoxzoClient sid = os.environ.get("XOXZO_API_SID") auth_token = os.environ.get("XOXZO_API_AUTH_TOKEN") @listen_to('(.*)ʹʮ(.*)ʯͱి࿩ͯ͠') def hello(message, phonnum, msg): message.reply('%sʹʮ%sʯͱి࿩͠·͢Ͷ' % (phonnum, msg)) xc = XoxzoClient(sid=sid, auth_token=auth_token) result = xc.call_tts_playback( tts_message=msg, tts_lang='ja', recipient="+81" + phonnum[1:], caller="+815012345678")