Base Webhook Object

class jook.models.webhooks.BaseWebhook(url, event, webhook_id=1, webhook_name='Webhook', mode='json', randomize=False, timer=0, *args, **kwargs)[source]

The base webhook object.

Contains all shared methods used by child objects.

  • url (str) – The target URL (must contain the scheme)
  • event (str) – The type of webhook event. The available event types are defined in the valid_event attribute for the object.
  • mode (str) –

    The type of data to send when calling fire().

    Can only be ‘json’ or ‘xml’

  • randomize (bool) –

    Values for the webhook object’s data are randomly generated every time when set to True.

    If False certain values are generated during the object’s creation and stored. These values will be the same each time fire() is called.

    If True those values will be set to None and generated at the time fire() is called.

  • timer (int) – An optional value in seconds to specify the delay when using start_timer().
  • webhook_id (int) – An optional ID value for the webhook event.
  • webhook_name (str) – An optional name for the webhook event.
  • InvalidEvent
  • InvalidMode
  • InvalidURL
  • TypeError

This method generates the object data in JSON or XML format which is set by the data_type attributes.

This method should be overridden by children that inherit this object.

The data object contains the event specific key-values. It is then updated with the key-values from _base_data.


Send a POST request containing the object’s data in the specified data type to the stored URL.


Start a series of :method: fire calls delayed by the value of timer in seconds for the number of times specified by repeat.

Parameters:repeat (int) – Number of times to execute :method: fire

Return the object’s data as JSON.

Returns:JSON string
Return type:str

Return the object’s data as XML.

Returns:XML string
Return type:str