Help
 Print
Webhooks
⚠️ The examples given below don't show all the properties for the models. The full model is properly described here: https://api.froged.com inside the Models tab.

Webhook Route has to allow POST requests so he can receive the data.
If the client wants to check what's received, they can use webs like [webhook.site](<http://webhook.site>) to see what they will exactly receive in their endpoint.

Authentication:

We provide a secret in the Webhook page that it's used as JWT signature for the request, it's sent as a header named: Froged-Webhook-Signature
With which the client can check that the request received belongs to FROGED.
For example, for JavaScript projects, they can use the jsonwebtoken library and use the method:

import * as jwt from 'jsonwebtoken';
jwt.verify(token, secret);

Where the token is the signature received as header ( Froged-Webhook-Signature ) and the secret is the one provided in the FROGED Platform in the Webhook panel under Settings > Developer Tools:


EXAMPLES:

1. Contact conversation created: 

Name: contact_conversation_created
Response: 
{
    "app": { "id": $ID, "name": $NAME, "slug": $SLUG },
    "event": "contact_conversation_created",
    "timestamp": $DATE,
    "data": {
      "conversation": {
        "id": $ID,
        "contact": { ... }
        "agent": { ... },
        "account": { ... },
        "closed": false,
        "unseenByAgent": true,
        "unseenByContact": false,
        "channel": $CHANNEL_TYPE,
        "fromUrl": $UL,
        "tags": [],
        "priority": false,
        "csatRating": null,
        "lastMessageAt": $DATE,
        "firstAgentActivityAt": $DATE,
        "firstAgentActivityFrom": $DATE,
        "firstContactActivityAt": $DATE,
        "lastAgentActivityAt": $DATE,
        "lastContactActivityAt": $DATE,
        "lastReopenedAt": $DATE,
        "responseTime": 0,
        "createdAt": $DATE,
        "updatedAt": $DATE
      }
    }
  }
 
2. Agent part added: 

Name: agent_part_added
Response:
{
  "app": { "id": $ID, "name": $NAME, "slug": $SLUG },
  "event": "agent_part_added",
  "timestamp": $DATE,
  "data": {
    "part": {
      "id": $OBJECT_ID,
      "idConversation": $OBJECT_ID,
      "type": $TYPE,
      "body": "",
      "author": "agent",
      "agent": { ... },
      "mode": "simple",
      "inReplyTo": null,
      "createdAt": $DATE,
      "updatedAt": $DATE
    }
  }
}

3. Agent part updated: 

Name: agent_part_updated
Response:
{
  "app": { "id": $ID, "name": $NAME, "slug": $SLUG },
  "event": "agent_part_updated",
  "timestamp": $DATE,
  "data": {
    "part": {
      "id": $ID,
      "idConversation": $ID_CONVERSATION,
      "type": "message",
      "body": $RAW_MESSAGE,
      "plainBody": $TEXT_MESSAGE,
      "author": "agent",
      "agent": { ... },
      "agentAssigned": { ... },
      "mode": "simple",
      "inReplyTo": null,
      "createdAt": $DATE,
      "updatedAt": $DATE
    }
  }
}

4. Agent part deleted: 

Name: agent_part_deleted
Response:
{
  "app": { "id": $ID, "name": $NAME, "slug": $SLUG" },
  "event": "agent_part_deleted",
  "timestamp": $DATE,
  "data": {
    "partDeleted": {
      "id": $ID,
      "idConversation": $ID_CONVERSATION,
      "type": $TYPE,
      "body": $MESSAGE,
      "author": "agent",
      "agent": { ... },
      "agentAssigned": { ... },
      "mode": "simple",
      "inReplyTo": null,
      "createdAt": $DATE,
      "updatedAt": $DATE
    }
  }
}

5. Contact part added: 

Name: contact_part_added
Response:
  {
  "app": { "id": $ID, "name": $NAME, "slug": $SLUG },
  "event": "contact_part_added",
  "timestamp": $DATE,
  "data": {
    "part": {
      "id": $OBJECT_ID,
      "idConversation": $OBJECT_ID,
      "type": $TYPE,
      "body": "",
      "author": "contact",
      "agent": { ... },
      "mode": "simple",
      "inReplyTo": null,
      "createdAt": $DATE,
      "updatedAt": $DATE
    }
  }
}

6. Contact part updated: 

Name: contact_part_updated
Response:

 {
  "app": { "id": $ID, "name": $NAME, "slug": $SLUG },
  "event": "contact_part_updated",
  "timestamp": $DATE,
  "data": {
    "part": {
      "id": $OBJECT_ID,
      "idConversation": $OBJECT_ID,
      "type": $TYPE,
      "body": "",
      "author": "contact",
      "agent": { ... },
      "mode": "simple",
      "inReplyTo": null,
      "createdAt": $DATE,
      "updatedAt": $DATE
    }
  }
}

7. Conversation asigned: 

Name: conversation_asigned
Response:
{
  "app": { "id": $ID, "name": $NAME, "slug": $SLUG },
  "event": "conversation_assigned",
  "timestamp": $DATE,
  "data": {
    "conversation": {
      "id": $ID,
      "contact": { ... },
      "agent": { ... },
      "subject": $TEXT,
      "type": $TYPE,
      "channel": $CHANNEL,
      "closed": false,
      "unseenByContact": true,
      "lastMessageAt": $DATE
    },
    "agentAssigned": { "idAgent": $ID, "name": $NAME },
    "agentWhoAssign": { "idAgent": $ID, "name": $NAME }
  }
}

8. Conversation group asigned: 

Name: conversation_group_asigned
Response:
{
  "app": { "id": $ID, "name": $NAME, "slug": $SLUG },
  "event": "conversation_group_assigned",
  "timestamp": $DATE,
  "data": {
    "conversation": {
      "id": $ID,
      "contact": { ... },
      "agent": {
        "idAgent": $ID,
        "name": $NAME
      },
      "subject": $TEXT,
      "type": $TYPE,
      "channel": $TYPE,
      "closed": false,
      "unseenByContact": true,
      "lastMessageAt": $DATE
    },
    "groupAssigned": {
      "id": $ID,
      "name": $NAME
      "agents": [
        {
          "idAgent": $ID,
          "name": $NAME
        },
      ],
      "routingMode": $ROUTING_MODE,
      "officeHoursActive": false,
      "officeHours": [ ... ],
      "createdAt": $DATE,
      "updatedAt": $DATE
    },
    "agentWhoAssign": {
      "idAgent": $ID,
      "name": $NAME
    }
  }
}

9. Conversation reopened: 

Name: conversation_reopened
Response:

{
  "app": { "id": $ID, "name": $NAME, "slug": $SLUG },
  "event": "conversation_reopened",
  "timestamp": $DATE,
  "data": {
    "conversation": {
      "id": $ID,
      "contact": {
        "id": $ID,
        "userId": $USER_ID,
        "name": $NAME
      },
      "agent": {
        "idAgent": $ID,
        "name": $NAME
      },
      "subject": $TEXT,
      "type": $TYPE,
      "channel": $TYPE,
      "closed": false,
      "unseenByContact": true,
      "lastMessageAt": $DATE
    }
  }
}

10. Conversation closed: 

Name: conversation_closed
Response:
{
  "app": { "id": $ID, "name": $NAME, "slug": $SLUG },
  "event": "conversation_closed",
  "timestamp": $DATE,
  "data": {
    "conversation": {
      "id": $ID,
      "contact": {
        "id": $ID,
        "userId": $USER_ID,
        "name": $NAME
      },
      "agent": {
        "idAgent": $ID,
        "name": $NAME,
      },
      "subject": $TEXT,
      "type": $TYPE,
      "channel": $TYPE,
      "closed": true,
      "unseenByContact": true,
      "lastMessageAt": $DATE
    }
  }
}

11. Conversation tag added: 

Name: conversation_tag_added
Response:
{
  "app": { "id": $ID, "name": $NAME, "slug": $SLUG },
  "event": "conversation_tag_added",
  "timestamp": $DATE,
  "data": {
    "conversation": {
      "id": $ID,
      "contact": {
        "id": $ID,
        "userId": $USER_ID,
        "name": $NAME
      },
      "agent": {
        "idAgent": $ID,
        "name": $NAME
      },
      "subject": $TEXT,
      "type": $TYPE,
      "channel": $TYPE,
      "lastMessageAt": $DATE
    },
    "tagAdded": {
      "id": $ID,
      "name": $NAME,
      "color": $COLOR,
      "createdAt": $DATE,
      "updatedAt": $DATE
    }
  }
}

12. Conversation tag deleted: 

Name: conversation_tag_deleted
Response:
{
  "app": { "id": $ID, "name": $NAME, "slug": $SLUG },
  "event": "conversation_tag_deleted",
  "timestamp": $DATE,
  "data": {
    "conversation": {
      "id": $ID,
      "contact": {
        "id": $ID,
        "userId": $USER_ID,
        "name": $NAME
      },
      "agent": {
        "idAgent": $ID,
        "name": $NAME
      },
      "subject": $TEXT,
      "type": $TYPE,
      "channel": $TYPE,
      "lastMessageAt": $DATE
    },
    "idTagDeleted": $ID
  }
}

13. NPS rated: 

Name: nps_rated
Response:
{
  "app": {
    "id": $ID,
    "name": $NAME,
    "slug": $SLUG
  },
  "event": "nps_rated",
  "timestamp": $DATE,
  "data": {
    "contact": {
      "id": $ID,
      "userId": $USER_ID,
      "name": $NAME
    },
    "rating": $NUMBER,
    "uuid": $ID
  }
}

Was this article helpful?
FROGED Help Center | 2024