Skip to content
Docs

Register a webhook

Early access. Tell us what you're building and we'll set you up. Contact us

POSTapi.lempile.com/api/v1/webhooks

Lempile calls request_url when something happens on an Instagram account. messaging: message_received, message_read, message_reaction, read from each account's inbox about every 10 minutes (not between 23:00 and 07:00 in the account's own time zone). account_status: the workspace's accounts, Instagram's included: connected, signed out, stopped by a security check, suspended, reconnected or removed (AccountStatus.message as Unipile, plus Lempile's status, previous_status and reason). The answer's secret signs every call (X-Lempile-Signature); it's shown this once.

Scope: accounts.write.

Authentication

X-API-KEY header·A Lempile API key, made in the dashboard under Access tokens.

Request body

  • request_urlstring · urirequired

    An https:// address on the public internet (no IP address, localhost or internal name).

  • sourcestringrequired
    One ofmessagingaccount_status
  • eventsarray of string

    The events to send. A messaging webhook without events gets message_received only, as on Unipile. An account_status webhook takes Unipile's names (creation_success, reconnected, ok, connecting, credentials, deleted) or Lempile's (account.status.disconnected…); without events it gets all of them.

  • account_idsarray of string

    messaging only: the workspace's Instagram accounts, by their Lempile id. Without it, every Instagram account of the workspace.

    ≤ 50 items
  • formatstring

    messaging only.

    One ofjsonformDefaultjson
  • dataarray of object

    messaging only: the payload then holds only these keys, each under its new name.

    ≤ 40 items
    ›Show fields
    • keystring
    • namestring
  • enabledboolean

    messaging only.

    Defaulttrue
  • namestring

    Your name for it, sent as webhook_name.

  • headersarray of object

    Headers added to every call.

    ≤ 10 items
    ›Show fields
    • keystring
    • valuestring

Responses

201

Registered.

›

application/json

  • objectany
    AlwaysWebhookCreated
  • webhook_idstring
  • secretstring

    Signs every call. Shown this once: store it.

400

errors/invalid_parameters: a field Lempile won't take; detail names it. Nothing was opened.

›

application/problem+json

  • typestringrequired
  • titlestring
  • statusintegerrequired
  • detailstring

    What happened, in words, and whether anything was done.

  • codestring

    On a 429: too_fast, daily_limit or hourly_limit.

  • retry_afterinteger

    Seconds to wait.

  • retry_atstring · date-time
401

A missing or invalid API key answers { "error": "unauthorized", "message" }. errors/disconnected_account (problem JSON): Instagram signed the account out; connect it again.

›

application/json

  • errorstringrequired
  • messagestring
402

subscription_required (in error): the workspace has no active trial or subscription.

›

application/json

  • errorstringrequired
  • messagestring
403

errors/insufficient_permissions (the key lacks the scope), errors/account_restricted (Instagram blocked the action, restricted the account or asks for a check: someone has to look at it on Instagram) or errors/action_required (the account waits for something done on Instagram itself; account_status and reason say what).

›

application/problem+json

  • typestringrequired
  • titlestring
  • statusintegerrequired
  • detailstring

    What happened, in words, and whether anything was done.

  • codestring

    On a 429: too_fast, daily_limit or hourly_limit.

  • retry_afterinteger

    Seconds to wait.

  • retry_atstring · date-time

Was this page helpful?