# Hey Manager API Whatsapp

# Register new channel

You must first contact the hey team to hire an official WA channel.

# Sandbox

Can use sandbox service for testing

https://sandbox.msgr.pro/api/

# Configure new channel

Send a POST request and create a new channel and configure it

POST /v1/new-channel

{
    "channel": "your-channel-id",
    "url": "your-url-from-the-response",
    "botApi": "your-bot-url",
    "apiKey": "your-apikey-from-oficial-WA",
    "settings": { // Setting WA account
        "about": "Ej. Servicio de mensajeria",
        "email": "Ej. contacto@heycenter.com",
        "address": "Ej. Calz de los Paraísos 239, Granja, 45010 Zapopan, Jal.",
        "wa_logo": "Ej. https://.../image640x640.jpg",
        "website": "Ej. https://heycenter.com",
        "category": "Ej. Others",
        "description": "Ej. Servicios de mensajeria"
    }
}

A successful request return the HTTP Status Code 200 OK and response object {"status": "success"}

# Receiving messages

HeyManager send a POST with new message

# Text message

{
    "message": {
        "id": "Message ID",
        "displayName": "WA username",
        "username": "WA id",
        "type": 'text',
        "text": "message"
    }
}

# Multimedia message

{
    "message": {
        "id": "Message ID",
        "displayName": "WA username",
        "username": "WA id",
        "type": "image|video|sticker|audio",
        "text": "caption if exists",
        "multimedia": {
            "id": "Multimedia ID",
        }
    }
}

# Status message

{
    "status": {
        "id": "message ID",
        "readAt": "Date",
        "sentAt": "Date",
        "deliveredAt": "Date",
        "errorCode": "Error on message"
    }
}

# Retrieve multimedia file

Get file content send GET request

GET /v1/message/media/{multimedia-id}

headers: {
    Hey-Api-Key: "your-channel-id"
}

# Send new message to Whatsapp

Send a POST request

POST /v1/message

headers: {
    Hey-Api-Key: "your-channel-id"
}

body: {
    "type": "text|image|video|audio|location",
    "text": "Required when type is text",
    "username": "WA id",
    "multimedia": {
        "file": "URL of file"
        "contentType": "Content type file"
    },
    "location": {
        "lat": "",
        "lng": ""
    }
}

A successful request return the HTTP Status Code 200 OK and response object {"id": "message-id"}

# Close conversation

Send a POST request

POST /v1/message/close

headers: {
    Hey-Api-Key: "your-channel-id"
}

body: {
    "username": "WA id"
}