Miscellaneous

class fbchat.ThreadLocation(Enum)[source]

Used to specify where a thread is located (inbox, pending, archived, other).

INBOX = 'INBOX'
PENDING = 'PENDING'
ARCHIVED = 'ARCHIVED'
OTHER = 'OTHER'
class fbchat.ActiveStatus(*, active, last_active=None, in_game=None)[source]
active

Whether the user is active now

last_active

When the user was last active

in_game

Whether the user is playing Messenger game now

class fbchat.QuickReply(*, payload=None, external_payload=None, data=None, is_response=False)[source]

Represents a quick reply.

payload

Payload of the quick reply

external_payload

External payload for responses

data

Additional data

is_response

Whether it’s a response for a quick reply

class fbchat.QuickReplyText(*, payload=None, external_payload=None, data=None, is_response=False, title=None, image_url=None)[source]

Represents a text quick reply.

title

Title of the quick reply

image_url

URL of the quick reply image

class fbchat.QuickReplyLocation(*, payload=None, external_payload=None, data=None, is_response=False)[source]

Represents a location quick reply (Doesn’t work on mobile).

class fbchat.QuickReplyPhoneNumber(*, payload=None, external_payload=None, data=None, is_response=False, image_url=None)[source]

Represents a phone number quick reply (Doesn’t work on mobile).

image_url

URL of the quick reply image

class fbchat.QuickReplyEmail(*, payload=None, external_payload=None, data=None, is_response=False, image_url=None)[source]

Represents an email quick reply (Doesn’t work on mobile).

image_url

URL of the quick reply image

class fbchat.Poll(*, session, id, question, options, options_count)[source]

Represents a poll.

session

ID of the poll

id

ID of the poll

question

The poll’s question

options

The poll’s top few options. The full list can be fetched with fetch_options

options_count

Options count

fetch_options()[source]

Fetch all PollOption objects on the poll.

The result is ordered with options with the most votes first.

Example

>>> options = poll.fetch_options()
>>> options[0].text
"An option"
Return type

Sequence[PollOption]

set_votes(option_ids, new_options=None)[source]

Update the user’s poll vote.

Parameters

Example

>>> options = poll.fetch_options()
>>> # Add option
>>> poll.set_votes([o.id for o in options], new_options=["New option"])
>>> # Remove vote from option
>>> poll.set_votes([o.id for o in options if o.text != "Option 1"])
class fbchat.PollOption(*, id, text, vote, voters, votes_count)[source]

Represents a poll option.

id

ID of the poll option

text

Text of the poll option

vote

Whether vote when creating or client voted

voters

ID of the users who voted for this poll option

votes_count

Votes count

class fbchat.Plan(*, session, id)[source]

Base model for plans.

Example

>>> plan = fbchat.Plan(session=session, id="1234")
session

The session to use when making requests.

id

The plan’s unique identifier.

fetch()[source]

Fetch fresh PlanData object.

Example

>>> plan = plan.fetch()
>>> plan.title
"A plan"
Return type

PlanData

edit(name, at, location_name=None, location_id=None)[source]

Edit the plan.

# TODO: Arguments

delete()[source]

Delete the plan.

Example

>>> plan.delete()
participate()[source]

Set yourself as GOING/participating to the plan.

Example

>>> plan.participate()
decline()[source]

Set yourself as having DECLINED the plan.

Example

>>> plan.decline()
class fbchat.PlanData(*, session, id, time, title, location=None, location_id=None, author_id=None, guests=None)[source]

Represents data about a plan.

time

Plan time, only precise down to the minute

title

Plan title

location

Plan location name

location_id

Plan location ID

author_id

ID of the plan creator

guests

User ids mapped to their GuestStatus

property going

List of the User IDs who will take part in the plan.

Return type

Sequence[str]

property declined

List of the User IDs who won’t take part in the plan.

Return type

Sequence[str]

property invited

List of the User IDs who are invited to the plan.

Return type

Sequence[str]

class fbchat.GuestStatus(Enum)[source]

An enumeration.

INVITED = 1
GOING = 2
DECLINED = 3