技能 产品商业 Podium消息工具有效流自动化

Podium消息工具有效流自动化

v20260423
podium-core-workflow-a
本工作流指导用户如何使用Podium API建立完整的实时消息通信系统。核心功能包括设置Webhook接收来自Podium的入站消息、实现自动回复逻辑,以及通过代码发送回复消息。适用于需要整合客户消息、评论和支付通知的商业场景。
获取技能
303 次下载
概览

Podium Core Workflow A

Overview

Build a complete messaging workflow with Podium: send messages, receive inbound messages via webhooks, and manage conversation threads.

Prerequisites

  • Completed podium-install-auth with OAuth tokens
  • Webhook endpoint accessible via HTTPS

Instructions

Step 1: Set Up Webhook for Inbound Messages

import express from 'express';
const app = express();

app.post('/webhooks/podium', express.json(), async (req, res) => {
  const event = req.body;
  if (event.type === 'message.received') {
    const msg = event.data;
    console.log(`From: ${msg.attributes['contact-phone']}`);
    console.log(`Body: ${msg.attributes.body}`);
    // Auto-reply or route to agent
    await sendReply(msg.attributes['location-uid'], msg.attributes['contact-phone'], 'Thanks for reaching out!');
  }
  res.status(200).json({ received: true });
});

Step 2: Register Webhook with Podium

const { data } = await podium.post('/webhooks', {
  data: {
    attributes: {
      url: 'https://your-app.com/webhooks/podium',
      events: ['message.received', 'message.sent', 'message.failed'],
    },
  },
});
console.log(`Webhook registered: ${data.data.id}`);

Step 3: Send Reply Messages

async function sendReply(locationId: string, phone: string, body: string) {
  const { data } = await podium.post(`/locations/${locationId}/messages`, {
    data: { attributes: { body, 'contact-phone': phone } },
  });
  return data.data.id;
}

Output

  • Webhook receiving inbound messages
  • Auto-reply capability
  • Two-way messaging via Podium

Error Handling

Error Cause Solution
Webhook not firing URL not HTTPS Use HTTPS endpoint
Message failed Invalid phone Verify E.164 format
No events received Wrong event types Check webhook configuration

Resources

Next Steps

Reviews and payments: podium-core-workflow-b

信息
Category 产品商业
Name podium-core-workflow-a
版本 v20260423
大小 2.59KB
更新时间 2026-04-28
语言