Contacts

GetGroups

get

This endpoint makes an HTTP GET request to retrieve groups from the WPBox API. It requires a token parameter in the query string. The parameter showContacts can also be included in the query string with a value of "no". The request does not contain a request body.

Response

The response to the request has a status code of 200 and returns a JSON object. The object includes a status field and an array of groups, where each group has an id, name, company_id, deleted_at, created_at, and updated_at fields.

Query parameters
tokenstringOptional
showContactsstringOptionalExample: no
Responses
200Success
get
GET /api/wpbox/getGroups HTTP/1.1
Host: www.app.samwad.tech
Accept: */*
200Success

No content

GetContacts

get

Get Contacts

This endpoint retrieves the list of contacts.

Request

Endpoint

GET api/wpbox/getContacts

Query Parameters

  • token (string, required): The authentication token.

Response

  • status (string): The status of the response.

  • contacts (array): An array of contact objects with the following properties:

    • id (integer): The unique identifier of the contact.

    • name (string): The name of the contact.

    • phone (string): The phone number of the contact.

    • avatar (string): The avatar URL of the contact.

    • country_id (integer): The ID of the country associated with the contact.

    • company_id (integer): The ID of the company associated with the contact.

    • deleted_at (string): The date and time when the contact was deleted, if applicable.

    • created_at (string): The date and time when the contact was created.

    • updated_at (string): The date and time when the contact was last updated.

    • last_reply_at (string): The date and time of the last reply from the contact.

    • last_client_reply_at (string): The date and time of the last reply from the client.

    • last_support_reply_at (string): The date and time of the last reply from the support team.

    • last_message (string): The last message sent by the contact.

    • is_last_message_by_contact (integer): Indicates if the last message was sent by the contact (1) or not (0).

    • has_chat (integer): Indicates if the contact has an active chat (1) or not (0).

    • resolved_chat (integer): Indicates if the chat with the contact is resolved (1) or not (0).

    • user_id (integer): The ID of the user associated with the contact, if applicable.

    • enabled_ai_bot (integer): Indicates if the AI bot is enabled for the contact (1) or not (0).

Example:

{
    "status": "",
    "contacts": [
        {
            "id": 0,
            "name": "",
            "phone": "",
            "avatar": "",
            "country_id": 0,
            "company_id": 0,
            "deleted_at": null,
            "created_at": "",
            "updated_at": "",
            "last_reply_at": "",
            "last_client_reply_at": null,
            "last_support_reply_at": "",
            "last_message": "",
            "is_last_message_by_contact": 0,
            "has_chat": 0,
            "resolved_chat": 0,
            "user_id": null,
            "enabled_ai_bot": 0
        }
    ]
}
Query parameters
tokenstringOptional
Responses
200Success
get
GET /api/wpbox/getContacts HTTP/1.1
Host: www.app.samwad.tech
Accept: */*
200Success

No content

GetContact

get

Get Contact

This endpoint retrieves data for single contact

Request

Endpoint

GET api/wpbox/getSingleContact

Query Parameters

  • token (string, required): The authentication token.

  • phone ( string, optional if contact_id is there )

  • contact_d ( string, optional if phone_id is there )

Response

  • status (string): The status of the response.

  • contact (array): Contact objects with

Query parameters
tokenstringOptional
phonestringOptional
contact_idstringOptional
Responses
200Success
get
GET /api/wpbox/getSingleContact HTTP/1.1
Host: www.app.samwad.tech
Accept: */*
200Success

No content

MakeContact

post

Make Contact

This endpoint allows you to make contact with a user.

  • The request should be sent to api/wpbox/makeContact using the HTTP POST method.

Request Body

The request body should be in the raw format and include the following parameters:

  • token (string): The token for authentication.

  • phone (string): The phone number of the contact.

  • name (string): The name of the contact. Optional

  • groups (string): Comma separated list of groups. Optional

  • custom (object): The custom fields of the contact. Optional

Response

  • Status: 200 OK

  • status (string): The status of the contact request.

  • contact (object): Details of the contact including id, name, phone, avatar, country_id, company_id, deleted_at, created_at, updated_at, last_reply_at, last_client_reply_at, last_support_reply_at, last_message, is_last_message_by_contact, has_chat, resolved_chat, user_id, and enabled_ai_bot.

Body
groupsstringOptionalExample: Europe,Asia
namestringOptionalExample: John Doe
phonestringOptional
tokenstringOptional
Responses
200
Success
application/json
post
POST /api/wpbox/makeContact HTTP/1.1
Host: www.app.samwad.tech
Content-Type: application/json
Accept: */*
Content-Length: 139

{
  "custom": {
    "email": "{{email}}",
    "location": "{{location}}"
  },
  "groups": "Europe,Asia",
  "name": "{{name}}",
  "phone": "{{phone}}",
  "token": "{{token}}"
}
200

Success

{
  "contact": {
    "avatar": null,
    "company_id": 1,
    "country_id": 196,
    "created_at": "2024-10-04T14:30:36.000000Z",
    "deleted_at": null,
    "email": null,
    "enabled_ai_bot": 1,
    "fields": [
      {
        "company_id": 1,
        "created_at": "2024-10-04T14:24:52.000000Z",
        "deleted_at": null,
        "id": 3,
        "name": "email",
        "pivot": {
          "contact_id": 4,
          "custom_contacts_field_id": 3,
          "value": "admin@example.com"
        },
        "type": "email",
        "updated_at": "2024-10-04T14:24:52.000000Z"
      },
      {
        "company_id": 1,
        "created_at": "2024-10-04T14:30:36.000000Z",
        "deleted_at": null,
        "id": 4,
        "name": "location",
        "pivot": {
          "contact_id": 4,
          "custom_contacts_field_id": 4,
          "value": "USA"
        },
        "type": "text",
        "updated_at": "2024-10-04T14:30:36.000000Z"
      }
    ],
    "groups": [
      {
        "company_id": 1,
        "created_at": "2024-10-04T14:24:54.000000Z",
        "deleted_at": null,
        "id": 4,
        "name": "Europe",
        "pivot": {
          "contact_id": 4,
          "group_id": 4
        },
        "updated_at": "2024-10-04T14:24:54.000000Z"
      },
      {
        "company_id": 1,
        "created_at": "2024-10-04T14:24:54.000000Z",
        "deleted_at": null,
        "id": 5,
        "name": "Asia",
        "pivot": {
          "contact_id": 4,
          "group_id": 5
        },
        "updated_at": "2024-10-04T14:24:54.000000Z"
      }
    ],
    "has_chat": 0,
    "id": 4,
    "is_last_message_by_contact": 0,
    "language": "none",
    "last_client_reply_at": null,
    "last_message": "",
    "last_reply_at": null,
    "last_support_reply_at": null,
    "name": "John Doe",
    "phone": "+38671246011",
    "resolved_chat": 0,
    "subscribed": 1,
    "updated_at": "2024-10-04T14:30:36.000000Z",
    "user_id": null
  },
  "status": "success"
}