首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >通过GupShup发送图像

通过GupShup发送图像
EN

Stack Overflow用户
提问于 2020-07-31 20:51:50
回答 1查看 267关注 0票数 0

正在尝试通过GupShup发送图像。我在用他们的沙盒。我的后端是带有feathersjs的node.js。但是它返回给我这个错误:

代码语言:javascript
复制
Response {
  size: 0,
  timeout: 0,
  [Symbol(Body internals)]: {
    body: PassThrough {
      _readableState: [ReadableState],
      readable: true,
      _events: [Object: null prototype],
      _eventsCount: 2,
      _maxListeners: undefined,
      _writableState: [WritableState],
      writable: false,
      allowHalfOpen: true,
      _transformState: [Object],
      [Symbol(kCapture)]: false
    },
    disturbed: false,
    error: null
  },
  [Symbol(Response internals)]: {
    url: 'https://api.gupshup.io/sm/api/v1/msg',
    status: 400,
    statusText: 'Bad Request',
    headers: Headers { [Symbol(map)]: [Object: null prototype] },
    counter: 0
  }
}

这是发送图像的代码

代码语言:javascript
复制
const form = new URLSearchParams();
  form.append('channel', 'whatsapp');
  form.append('destination', destination);
  form.append('source', app.get('GUPSHUP_NUMBER'));
  form.append('message.payload', JSON.stringify(message));
  form.append('src.name', 'OneAccess');
  console.log(form);
  try {
    const res = await fetch('https://api.gupshup.io/sm/api/v1/msg', {
      method: 'POST',
      body: form,
      headers: {
        'Content-Type': 'application/x-www-form-urlencoded',
        apikey: app.get('GUPSHUP_API'),
      },
    });

    console.log('result message', res);
  } catch (err) {
    console.log('errro sending msg', err);
  }

这就是我想要传达的信息

代码语言:javascript
复制
message: {
        type: 'image',
        originalUrl:
          'https://images.pexels.com/photos/248797/pexels-photo-248797.jpeg',
        previewUrl:
          'https://images.pexels.com/photos/248797/pexels-photo-248797.jpeg',
        caption: 'Sample image',
      },

有谁可以帮我?

EN

回答 1

Stack Overflow用户

发布于 2020-08-14 01:22:00

message.payload更改为message。您可以在https://www.gupshup.io/developer/docs/bot-platform/guide/whatsapp-api-documentation#SendImage上检查正确的签名

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63192202

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档