Operational

DocsGithub Open app

Operational

Github Articles Pitch Usecases Playground API

Contents

Start hereAPI DocsIntroductionSend your first eventEvent parametersStructured EventsActionsContextsCategoriesError handlingManualIntroductionBasicsConventionsSetupTest modeNotificationsPWASelf hostingIntroductionInstall locallyInstall on VPSInstall on RenderInstall via DockerInstall via Docker and CoolifyOnboardingSetup .envIntegrationsBest practicesOtherVisionRoadmapContributing

Sending actions in events

Action are objects that will render Action buttons inside the event UI. Pressing these buttons will send a webhook to your server.

Here’s a simple example:

const e = {
  name: "a critical event",
  avatar: "🤖",
  actions : [
    {
      url : 'https://webhook.site',
      buttonText : 'Press me'
    }
  ]
};
Copy

You can also have static buttons which simply open up a webpage. Here’s another example:

🤖
12:00 ama critical event
const e = {
  name: "a critical event",
  avatar: "🤖",
  actions : [
    {
        url : 'https://stripe.com',
        external : true,
        buttonText : 'Press me'
      }
  ]
};
Copy

You can pass Actions as a json array. Each object in the array has these params:

urlstring required

A valid url, eg https://stripe.com, http://server.io, etc.

buttonTextstring required

Set the text of the button, eg: Send email to customer, Activate user, Open in stripe, etc.

keystring required

A unique string to identify the action. Use this on your server to differentiate between different actions. For actions marked as external, no key is needed.

externalboolean

If set, opens the url in a external tab. Show a link icon in the button and behaves like a anchor tag basically.

expireInnumber

Action cannot be run after in ‘expireIn’ minutes. Defaults to 10080(7 days). Max value cannot be more than 43200. We recommend this value to be as small as reasonably possible.

metastring/json

Defaults to null. This can be a string, or a object. This will be passed to the server when this action is triggered.

const e = {
  name: "some event",
  avatar: "🤖",
  type : "rows",
  actions : [
    {
      url : 'https://yourserver.com/api/someroute',
      buttonText : 'Press me',
      key : "press_me",
      external : false,
      expireIn : 10080,
      meta : {
        name : "Shash",
        id : 1,
      }
    },
  ]
};
Copy

How do actions work?

When pressed, our server will send a POST request to the url specified. It will wait for 10 seconds and give up after that. If the server sends back a 200 or a 201 response status, the actions is marked as complete.

Actions are great for triggering atomic events. For instance, you can use actions to ban users, or delete a user record. There are multiple safeguards in place to make sure you don’t trigger atomic actions accidently.

Here’s a quick setup for banning users.

Note the really small expireIn time. This will ensure we cannot run our trigger after 2 hours from now(where it won’t be effective).

Structured EventsContexts

Operational

Event tracker for your product.

PrivacyTerms
About the product
  • Playground
  • API
  • Pitch
  • Wordpress plugin
  • Bubble plugin
Related to the product
  • VS Logsnag
  • Open Source
  • Articles
Useful articles for your business
  • Force post: The Payment Hack that lets Merchants charge you without approval
  • 6 Best practices for early stage B2B SaaS customer support
  • Setup event notifications for your SaaS
  • How to get high quality users for your B2B SaaS business?