Skip to main content
https://img.shields.io/pypi/v/messengerbot.svg https://img.shields.io/pypi/dm/messengerbot.svg Build Status https://img.shields.io/gratipay/geeknam.svg

Python client for Messenger Platform API

Installation

pip install messengerbot

Usage

Read about Messenger Platform

from messengerbot import MessengerClient, messages, attachments, templates, elements

# Manully initialise client
messenger = MessengerClient(access_token='your_token')

# With env var export MESSENGER_PLATFORM_ACCESS_TOKEN=your_token
from messengerbot import messenger

recipient = messages.Recipient(recipient_id='123')

# Send text message
message = messages.Message(text='Hello World')
request = messages.MessageRequest(recipient, message)
messenger.send(request)

# Send button template
web_button = elements.WebUrlButton(
   title='Show website',
   url='https://petersapparel.parseapp.com'
)
postback_button = elements.PostbackButton(
   title='Start chatting',
   payload='USER_DEFINED_PAYLOAD'
)
template = templates.ButtonTemplate(
   text='What do you want to do next?',
   buttons=[
       web_button, postback_button
   ]
)
attachment = attachments.TemplateAttachment(template=template)

message = messages.Message(attachment=attachment)
request = messages.MessageRequest(recipient, message)
messenger.send(request)

Download files

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

Source Distribution

messengerbot-0.1.4.tar.gz (4.0 kB view details)

Uploaded Source

File details

Details for the file messengerbot-0.1.4.tar.gz.

File metadata

  • Download URL: messengerbot-0.1.4.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for messengerbot-0.1.4.tar.gz
Algorithm Hash digest
SHA256 f5d019d95736793cae2a249531862371b81fd6b16ce501f78f837e3886cde949
MD5 f889a55baeb21c9e64aecc3dd4904fb3
BLAKE2b-256 e9e5874e7853fc3cd64c87e8a5c013723ecb33ee55eb9d6f7fc4188090b75188

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.4 This release

1 file

0.1.3

1 file

0.1.2

1 file

0.1.1

1 file

0.1

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page