Zalo Pin Message icon

Zalo Pin Message

Ghim/bỏ ghim cuộc trò chuyện trong Zalo

Overview

This node allows users to manage pinned conversations in a messaging platform. Specifically, it supports operations to pin a conversation, unpin a conversation, and retrieve the list of currently pinned conversations. This is useful for organizing important chats by keeping them easily accessible at the top of the conversation list.

Practical examples include:

  • Pinning a user or group chat that requires frequent attention.
  • Unpinning conversations that are no longer a priority.
  • Fetching all pinned conversations to display or process them elsewhere.

Properties

Name Meaning
Thread ID The unique identifier of the conversation (thread) to pin or unpin.
Thread Type The type of conversation: either "User" for one-on-one chats or "Group" for group chats.

Output

The node outputs JSON data with the following structure depending on the operation:

  • For Pin Conversation and Unpin Conversation:

    {
      "success": true,
      "operation": "pinConversation" | "unpinConversation",
      "threadId": "string",
      "threadType": "user" | "group",
      "result": {
        "success": true,
        "result": {},          // API response object from the pin/unpin action
        "methodUsed": "pinConversation" | "unpinConversation",
        "parameters": [ "threadId", true|false ],
        "debug": {
          "threadId": "string",
          "threadType": "user" | "group",
          "apiResult": {}       // Raw API result for debugging
        }
      }
    }
    
  • For Get Pinned Conversations:

    {
      "success": true,
      "operation": "getPinnedConversations",
      "conversations": [],     // Array of pinned conversation objects
      "version": null | string,// Version info if available
      "methodUsed": "getPinConversations",
      "debug": {
        "apiResult": {}        // Raw API response for debugging
      }
    }
    

If an error occurs, the output JSON will contain:

{
  "success": false,
  "error": "Error message describing what went wrong"
}

The node does not output binary data.

Dependencies

  • Requires an API key credential for authentication with the messaging platform.
  • Uses an external library (imported as Zalo) to interact with the messaging service's API.
  • The node logs into the service using stored cookie and device information from the credentials.
  • No additional environment variables are explicitly required beyond the API credential.

Troubleshooting

  • Common issues:

    • Missing or invalid API credentials will cause login failures.
    • Incorrect Thread ID or Thread Type may lead to API errors or unsuccessful pin/unpin actions.
    • Network connectivity problems can prevent communication with the messaging service.
  • Error messages:

    • "No credentials got returned!" indicates missing or improperly configured API credentials.
    • Errors during pin/unpin attempts often include the underlying API error message; verify thread IDs and types.
    • If the node throws an error about failed login, check the validity of the stored cookie and device info.
  • Resolutions:

    • Ensure the API key credential is correctly set up and authorized.
    • Double-check the Thread ID and Thread Type inputs.
    • Verify network access and retry if transient errors occur.

Links and References

  • Messaging platform API documentation (not provided here).
  • n8n documentation on creating custom nodes and handling credentials.
  • External library used for API interaction (referred to as Zalo in code).

Discussion