Skip to main content

Robin.io-py is a Python SDK built to communicate with the Robinapp API. Now you can integrate Robin.io with minimal effort and quickly setup a real-time messaging platform in your Web application.

Project description

Robin.io-py

PyPI version PyPI - Python Version

Table of contents

Table of Contents
  1. Introduction
  2. Prerequisites
  3. Getting Started
  4. Sending your first message
  5. License

View Documentation Here

Introduction

Robin.io-py is a Python SDK built to communicate with the Robinapp API. Now you can integrate Robin.io with minimal effort and quickly setup a real-time messaging platform in your Web application.

Prerequisites

The following packages are required to use the sdk:

  • Requests
  • Websocket-Client

Getting started

Step 1: Create a Robinapp account

A Robinapp account comprises everything required in a chat service including users, message, and api-keys. To create an application:

  1. Go to the Robinapp Dashboard and enter your email and password, and create a new account.
  2. Navigate to Api Config and copy your API key

Note: All the data is limited to the scope of a single user account, thus the users in different Robinapp accounts are unable to chat with each other.

Step 2: Install the Chat SDK

  ## PIP

  pip3 install robin.io-py

Sending your first message

Follow the step-by-step instructions below to authenticate and send your first message.

Authentication

To use the features of the Chat SDK in your client app, a robin instance must be initiated in each client app before user authentication with Robin server. These instances communicate and interact with the server based on an authenticated user account, allowing for the client app to use the Chat SDK features.

Step 1: Initialize the Chat SDK

To initialize a Robin instance, pass the API key as the first argument to in the Robin() method, You can find your API key in the API Configuration tab in your Robin Account.

Then true or false for as the second parameter as it tells the sdk whether to load with ssl or not.

Note: It is recommended to initialize the Chat SDK at the top of your Python file.

robin = Robin("<api_key>", True)

Step 2: Connect to Robin server

You'll need a USER_TOKEN to connect to the Robin server.

A. Create User Token

Create user token

response = robin.create_user_token(data={
    "meta_data":{
        "name": "Samuel 0.",
    }
})

Connect to the Robin server using the USER_TOKEN you just created.

robin.connect(user_token="<api_key>")

Step 3: Channels

All messages sent via Robin are sent through channels, you can consider channels as tunnels that relay messages to all connected clients.

Step 4: Create a conversation

Before we can send a message to a channel we first need to create a converstion.

response = robin.create_conversation(sender_token="<sender_token>", sender_name="<sender_name>", receiver_token="<reciever_token>", receiver_name="<reciever_name>")    

Step 5: Send a message to a conversation

Finally, send a message to a conversation.

robin.send_conversation_message(msg={}, channel="<channel_id>", conversation_id="<conversation_id>", sender_token="<sender_token>")

Options

The following are general attributes used in Robin:

Attribute Type Default Description
Conn WebSocket null Websocket opbject returned after calling robin.connect()
sender_name String '' Name of the person sending the message
sender_token String '' USER_TOKEN of the person sending the message
receiver_name String '' Name of the person receiving the message
receiver_token String '' USER_TOKEN of the person receiving the message
msg Object {} Json serializable object containing the message

If you have any comments or questions regarding bugs and feature requests, visit Robinapp community.

View Documentation Here.

License

Distributed under the MIT License. See LICENSE for more information.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

robin.io_py-0.0.4-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file robin.io_py-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: robin.io_py-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for robin.io_py-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 b5b9cbe9049ae468474105163e2452a642f91c56ccd6d53256bcbf886636f2d6
MD5 15d165314400f52bc185f24f37ef57b6
BLAKE2b-256 ec8b3396fd24f6d3729f385bcb09f233c1f73d856af7afad4064f900fd7d5b59

See more details on using hashes here.

Supported by

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