Skip to main content
Version: 3.0.0

CODECHAT

Whatsapp Web API

codechat-cover

It is a high performance scalable API that uses http requests to communicate with WhatsApp; as per the documentation below.

Requests return: JSON

Webhook [POST]

The events are informed in the event attribute in the object that is sent through the body of the http request.

Instance

  • connection.update: Informs the status of the connection with whatsapp - open - connecting - close - refused.
  • qrcode.updated: Sends the base64 of the qrcode for reading.

Chats

  • chats.set: Send a list of all loaded chats.
  • chats.upsert: Informs the status of the connection with whatsapp.
  • chats.update: Informs you when the chat is updated.
  • presence.update: Informs if the user is online, if he is performing some action like writing or recording and his last seen.

Contact

  • contacts.upsert: Sends the list of contacts loaded.
    • This information may take some time to arrive depending on the size of your contact list.
    • For example: a list of 200 contacts, it can take up to 45 seconds to load all contacts.
  • contacts.update: informs you when the contact is updated.

Message

  • new.message: Tells you when a message is received.
    • - ⚠️Heads up⚠️: For media messages larger than 8MB in size, automatic conversion to base64 is not performed.
    • Use the /chat/base64MediaMessage route to do the conversion.
  • messages.update: Tells you when a message is updated.
    • Example: message DELIVERY_AT - READ - REVOKE.
      • REVOKE: notify everyone when a message is deleted
  • messages.set: Sends a list of all your old messages uploaded to whatsapp.
    • This event can be repeated according to the number of messages you have.
    • ⚠️So beware⚠️: This event is triggered immediately after reading the qr code. After the messages are loaded, the event does not occur again
  • status.broadcast: Notifies when a contact publishes a Status

Send Message

  • send.message:START - Indicates the start of the submission process.
  • send.message:PROCESSING - Informs the processing of sending messages from 0 to 100%.
  • send.message:COMPLETED - Notifies the completion of the submission process.
    • Upon completion, the queue is automatically cleared by the system.
  • send.message:ERROR - Notifies the error and its cause during the processing of the mailing list, but does not interrupt it.

Group

  • group:participant.update: Notifies when there is any modification of the group member.
    • 'add' | 'remove' | 'promote' | 'demote'
  • group.upsert: Notifies when a group is created.
  • group.update: Notifies when there is any change in the group

Queue Manager

  • paused.queue: Informs the moment when the respective queue was paused.
  • resumed.queue: Informs the moment when the respective queue was resumed.
  • deleted.queue: Inform the moment when the respective queue was deleted.

Payment

  • request.payment: Inform the moment of your payment request.
  • decline.payment: Inform informs you that you declined a payment message received by your contact, or that the recipient refused your payment request.
  • cancel.payment: Report informs you that you canceled a payment message sent by your contact, or that a contact canceled a payment request sent to you.
  • send.payment: Informs that you have received a payment, which may be the answer to your request.

Error

  • general.error: Report the error linked to an event.

Options object

The options object is inserted in each message to be sent and has three attributes:

  • delay: Determines the delay in which each message will be sent. The delay property can receive either a single integer value or an array of two-position integers.

  • quoted: Receives the messageId attribute, which is the reference of the message to be quoted;

  • mentions: It is related to the mention of participants in a group, and also has three attributes:

    1. everyone: Mention all participants in a group, and directly reference these participants in the message;
    2. ghostMention: Works in conjunction with the everyone property. Mentions all participants but removes the direct reference.
    • Ex:

      {
      "options": {
      "everyone": true,
      "ghostMention": true
      }
      }
    1. mentioned: Mention specific participants in a group.
    • Ex:
      {
      "numbers": [
      "[email protected]"
      ],
      "options": {
      "delay": 1200 | [1200, 8000],
      "mentions": {
      "mentioned": [
      "5531911111111",
      "5531922222222",
      "5511933333333"
      ]
      }
      },
      "textMessage": {
      "text": "Hello @5531911111111 and @5531922222222 responsible for sector is @5511933333333"
      }
      }

NOTE

The everyone attribute overrides the mentioned* attribute.

Authentication

Authentication key generated after completing the registration

Security Scheme Type:apiKey
Header parameter name:apikey