Skip to main content

Python SDK for RCS MaaP chatbot

Project description

rcs_chatbot

A Python SDK for RCS MaaP chatbots.

Installation

pip install rcs_chatbot

Example

See more examples in the example folder.

import flask
import rcs_chatbot

chatbot = rcs_chatbot.Chatbot(
  "API_URL",
  "BOT_ID",
  "TOKEN"
)

app = flask.Flask(__name__)

@app.route('/', methods=['POST'])
def event():
  try:
    chatbot.processEvent(flask.request.get_json())
    return "ok", 200
  except:
    pass

@chatbot.registerEventHandler(rcs_chatbot.EventType.MESSAGE)
def messageHandler(event):
  contact = rcs_chatbot.MessageContact("+18055551234", None)

  suggestions = rcs_chatbot.Suggestions()
  suggestions.addReply("reply", "reply")
  suggestions.addUrlAction("url", "url", "http://example.com")

  chatbot.sendMessage(contact, "Howdy", suggestions)

if __name__ == '__main__':
    app.run(port=5000, debug=False)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rcs_chatbot-0.0.2.tar.gz (3.4 kB view hashes)

Uploaded Source

Built Distribution

rcs_chatbot-0.0.2-py3-none-any.whl (6.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page