Maytapi Trigger icon

Maytapi Trigger

Handle Maytapi events via webhooks

Maytapi Trigger

AI-generated

Overview

This node acts as a webhook trigger for Maytapi events, enabling workflows to respond automatically when specific WhatsApp-related events occur. It listens for incoming HTTP POST requests from the Maytapi service and triggers the workflow based on selected event types.

Common scenarios where this node is beneficial include:

  • Automating responses or processing when new WhatsApp messages are received or sent.
  • Tracking message delivery status changes such as sent, delivered, or read acknowledgments.
  • Monitoring group activities like members joining or leaving, or group setting changes.
  • Handling call events related to incoming or outgoing WhatsApp calls.
  • Reacting to contacts posting new stories on WhatsApp.

Practical examples:

  • Automatically logging all incoming messages into a CRM system.
  • Sending notifications when a message is read by the recipient.
  • Updating group membership records in a database when users join or leave.
  • Triggering alerts or call logs when WhatsApp calls occur.
  • Archiving or analyzing story posts shared by contacts.

Properties

Name Meaning
Events Select which Maytapi event types should trigger this webhook. Options:
- Message Event
- Message Status (ACK)
- Group Member Events
- Call Events
- Story Events

Output

The node outputs JSON data representing the event payload received from Maytapi, enriched with additional parsed fields depending on the event type:

  • Common fields:

    • body: The full raw event body received.
    • headers: HTTP headers of the webhook request.
    • query: Query parameters of the webhook request.
    • eventType: The detected event type (e.g., "message", "ack", "group", "call", "story").
  • Message Event:

    • messageType, messageSubtype
    • fromNumber, fromName
    • receiver
    • messageText
    • messageId
    • timestamp
    • fromMe (boolean indicating if the message was sent by the authenticated user)
    • conversation, conversationName
    • participant
  • Message Status (ACK):

    • messageId
    • ackStatus (delivery status such as sent, delivered, read)
    • timestamp
  • Group Member Events:

    • groupId
    • groupName
    • groupAction (type of group event)
    • participant
    • messageId
    • timestamp
  • Call Events:

    • callId
    • callSubtype
    • callStatus (parsed from subtype)
    • fromNumber, fromName
    • receiver
    • messageId
    • timestamp
  • Story Events:

    • storyId
    • storyFrom (phone number of the contact who posted the story)
    • storyFromName
    • storyType
    • storyText
    • messageId
    • timestamp
    • receiver

If the event type does not match any of the selected triggers, the node returns no data.

The node does not output binary data.

Dependencies

  • Requires an API key credential for authenticating with the Maytapi service.
  • Needs proper configuration of the webhook URL in Maytapi to point to the n8n webhook endpoint.
  • The node uses internal API requests to Maytapi to create, check, and delete webhooks via the Maytapi API.

Troubleshooting

  • Webhook URL mismatch: If the webhook URL configured in Maytapi does not match the one generated by n8n, the node will not receive events. Ensure the webhook URL is correctly set and accessible.
  • Invalid or missing API credentials: The node requires valid API authentication credentials. Errors during webhook creation or deletion often indicate credential issues.
  • Event filtering: If no workflow executions occur, verify that the selected event types in the node properties match the actual incoming event types.
  • Phone ID mismatch: The node checks that the phone ID in the event matches the configured credential's phone ID. Events with mismatched phone IDs are ignored.
  • Error messages:
    • "Failed to create webhook: ..." indicates problems registering the webhook with Maytapi; check API credentials and network connectivity.
    • "Failed to delete webhook: ..." indicates issues removing the webhook; verify permissions and API access.
  • Debugging: The node logs detailed information about received events and processing steps to the console, which can help diagnose issues.

Links and References

Discussion