API and Webhooks

Overview

The API tab allows you to request API credentials for your account and create webhook notifications

API

Sakari has a RESTful API. Please see our developer docs for details.

To request your API credentials: 

  • Go to Settings > Account Settings
  • Select the API tab
  • Click the Generate button
  • You will receive: 
    • Account Id - your Sakari ID
    • Client Id - your Sakari client ID
    • Client Secret - your Sakari client secret 

Webhook

To create a new Sakari webhook: 

  • In the left navigation select Settings > Account Settings
  • Select the API tab
  • Click the Create Webhook button
  • Select your preferred webhook triggering criteria
  • Select your destination URL
  • Click Save
Screen_Shot_2023-05-19_at_5.56.13_PM.png
 

Webhook triggers:

 

Screen_Shot_2023-05-19_at_5.56.51_PM.png

An example request body would look like the following.

{
  "accountId": "$ACCOUNT_ID",
  "eventType": "message-received",
  "payload": {
    "accountId": "$ACCOUNT_ID",
    "conversation": {
      "id": "$CONVERSATION_ID",
      "closed": "$CLOSED_AT",
      "group": {
        "id": "$GROUP_ID"
      },
      "phoneNumber": {
        "id": "$PHONE_NUMBER_ID",
        "number": "$PHONE_NUMBER",
        "country": "US"
      }
    },
    "group": {
      "id": "$GROUP_ID",
      "name": "$GROUP_NAME"
    },
    "contact": {
      "id": "$CONTACT_ID",
      "firstName": "$FIRST_NAME",
      "lastName": "$LAST_NAME",
      "mobile": {
        "number": "$MOBILE_NUMBER",
        "country": "US"
      },
      "email": "$USER_EMAIL",
      "created": {
        "at": "$CREATED_AT",
        "by": {
          "id": "$USER_ID",
          "name": "$USER_NAME",
          "source": "$SOURCE",
          "email": "$USER_EMAIL"
        }
      },
      "hubspot": {
        "vid": "$HUBSPOT_VID",
        "id": "$HUBSPOT_ID"
      }
    },
    "job": {
      "id": "$JOB_ID"
    },
    "type": "sms",
    "message": "Test message 👋🏻",
    "status": "received",
    "outgoing": false,
    "country": "US",
    "segments": 1,
    "price": "$PRICE",
    "read": false,
    "operational": false,
    "media": [],
    "id": "$MESSAGE_ID",
    "created": {
      "at": "$CREATED_AT",
      "by": {
        "id": "$CREATOR_ID",
        "name": "$USER_NAME",
        "source": "$SOURCE",
        "subSource": "$SUB_SOURCE"
      }
    },
    "updated": {
      "at": "$UPDATED_AT",
      "by": {
        "id": "$UPDATER_ID",
        "name": "$USER_NAME",
        "source": "$SOURCE",
        "subSource": "$SUB_SOURCE"
      }
    }
  }
}