webhooks

Register a Message Webhook

POST https://app.ayrshare.com/api/hook/webhook

Headers

Name
Type
Description

Authorization*

string

Format: Authorization: Bearer API_KEY. See Overview for more information. Please use the Primary API Key.

Request Body

Name
Type
Description

action*

string

Available actions: message

url*

string

The URL to be called on action. URL must be in a valid format and begin with https://

secret

string

Secret text used for HMAC. Please see here.

{
    "status": "success",
    "action": "message",
    "url": "https://mysite.com/hook"
}

Actions

Message

Notification when a new message is sent, received, deleted, or a reaction. Messages are supported by Twitter, Instagram, and Facebook.

Enterprise Plan required.

Create Example:

{
  "action": "message",
  "subAction": "create", // create, delete, reaction
  "created": "2023-01-05T01:18:47Z",
  "code": 200,
  "refId": "140b8700bd6ade089b242d845e268fb886130c53",
  "message": {
    "text": "Happy days are here",
    "platform": "twitter",
    "status": "success",
    "id": "954491830116155396",
    "sender": {
      "id": "3001969357",
      "name": "Joe Smith",
      "username": "joesmith",
      "location": "Burlington, MA",
      "profileImageUrl": "https://pbs.twimg.com/profile_images/851526626785480705/cW4WTi7C_normal.jpg",
      "followers": 22,
      "statusViews": 56
    },
    "receiver": {
      "id": "3001969444",
      "name": "Sue Johnson",
      "username": "suejohn",
      "location": "Seattle, WA",
      "profileImageUrl": "https://pbs.twimg.com/profile_images/851526626785480705/cW4WTi7C_normal.jpg",
      "followers": 45,
      "statusViews": 454
    },
    "data": {
      "hashtags": ["super", "one"],
      "userMentions": ["suesmith"],
      "urls": ["https://www.ayrshare.com"]
    },
    "media": [
      {
        "type": "image",   // video, image, audio, file
        "url": "https:///media.url"
      }
    ],
  }
}

Reaction Example:

{
  "action": "message",
  "subAction": "reaction", // create, delete, reaction
  "created": "2023-01-05T01:18:47Z",
  "code": 200,
  "refId": "140b8700bd6ade089b242d845e268fb886130c53",
  "message": {
    "platform": "instagram",
    "status": "success",
    "id": "954491830116155396",
    "sender": {
      "id": "3001969357",
      "name": "Joe Smith",
      "username": "joesmith",
      "location": "Burlington, MA",
      "profileImageUrl": "https://instagram/image.jpg",
      "followers": 22,
      "statusViews": 56
    },
    "receiver": {
      "id": "3001969444",
      "name": "Sue Johnson",
      "username": "suejohn",
      "location": "Seattle, WA",
      "profileImageUrl": "https://instagram/image.jpg",
      "followers": 45,
      "statusViews": 454
    },
    "data": {
      "reactionType": "create", // create or delete
      "reaction": "love",       // optional, to unreact if there is no reaction field
      "emoji": "\u{2764}\u{FE0F}" // optional, to unreact if there is no emoji field
    }
  }
}

Last updated