从 twilio 获取响应的消息 sid
Get the message sid of a response from twilio
我正在 api 中收到一条消息,然后对其进行处理。此传入消息 api 调用为我提供了传入消息的 "messageSid"。当我处理这个时,首选的解决方案似乎是用
之类的东西来回应
<Response>
<Message>Thank you</Message>
</Response>
这很有效,但遗憾的是我没有用于响应消息的 Sid。由于两者都会产生费用,是否有办法获得这个 Sid 以便我可以存储它?我正在使用 C#,但目前我没有使用 SDK。
我唯一的想法是 return 一个空回复,然后自己将回复作为一条新消息发送...但这看起来很尴尬。
我想我可以从回调中得到它? (但是如果 twilio 平台失败并且我没有收到回调怎么办)。
还有其他建议吗?
这里是 Twilio 开发人员布道者。
您无法通过使用 TwiML 的响应直接获取 SID。
如果您在发送消息后立即需要 SID,那么我推荐您的第一个建议,回复空 <Response/>
和 use the REST API to send the SMS。
或者,您可以设置 action
attribute on the <Message>
element. The action
should be a URL and Twilio will make a webhook request to it every time the message changes status. Along with the status, you will also receive the message Sid and all the standard TwiML message parameters。
如果有帮助请告诉我。
我正在 api 中收到一条消息,然后对其进行处理。此传入消息 api 调用为我提供了传入消息的 "messageSid"。当我处理这个时,首选的解决方案似乎是用
之类的东西来回应<Response>
<Message>Thank you</Message>
</Response>
这很有效,但遗憾的是我没有用于响应消息的 Sid。由于两者都会产生费用,是否有办法获得这个 Sid 以便我可以存储它?我正在使用 C#,但目前我没有使用 SDK。
我唯一的想法是 return 一个空回复,然后自己将回复作为一条新消息发送...但这看起来很尴尬。
我想我可以从回调中得到它? (但是如果 twilio 平台失败并且我没有收到回调怎么办)。
还有其他建议吗?
这里是 Twilio 开发人员布道者。
您无法通过使用 TwiML 的响应直接获取 SID。
如果您在发送消息后立即需要 SID,那么我推荐您的第一个建议,回复空 <Response/>
和 use the REST API to send the SMS。
或者,您可以设置 action
attribute on the <Message>
element. The action
should be a URL and Twilio will make a webhook request to it every time the message changes status. Along with the status, you will also receive the message Sid and all the standard TwiML message parameters。
如果有帮助请告诉我。