Nasıl Facebook messenger platformdan konumu göndermesine?

oy
10

Orada bir cep istemciden facebook-messenger için konumumu göndermek için bir yoldur, ama nasıl bir bot bazı konumunu gönderebilir? (Haberci platformu API)

Ben bot benzer bir yapıya göndermek çalıştığınızda bir hata alıyorum: (#100) Unsupported attachment type

bot dan konumumu göndermek için bir yolu var mı?

bot alınan mesaj örneği:

{
   object: page,
   entry: [{
       id: 1719442148306048,
       time: 1466780344978,
       messaging: [{
           sender: {id: 123456789},
           recipient: {id: 987654321},
           timestamp: 1466780344847,
           message: {
               mid: mid.12345698875:c80066d69b6cee1779,
               seq: 65,
               attachments: [{
                   title: Dmitry's Location,
                   url: Link to bing.com through facebook redirect
                   type: location,
                   payload: {coordinates: {lat: 55, long: 37}}
               }]
           }
       }]
   }]
}

Böyle eki ile mesaj göndermek deneyin:

               attachment: {
                   type: location,
                   payload: {coordinates: {lat: 55, long: 37}}
               }
Oluştur 24/06/2016 saat 15:50
kaynak kullanıcı
Diğer dillerde...                            


2 cevaplar

oy
22

Çözüm yoktur. Biz dinamik statik harita görüntüsü ve url ile genel bir şablon gönderebilir. IOS yerli harita uygulama için biz adresi kullanabilirsiniz http://maps.apple.com/maps (aynı parametrelerle Google Maps olmayan tüm iOS kullanıcıları yönlendirir). Android'de Google Maps uygulamasını açar.

{
    "recipient": {"id": "132456"},
    "message": {
        "attachment": {
            "type": "template",
            "payload": {
                "template_type": "generic",
                "elements": {
                    "element": {
                        "title": "Your current location",
                        "image_url": "https:\/\/maps.googleapis.com\/maps\/api\/staticmap?size=764x400&center="+lat+","+long+"&zoom=25&markers="+lat+","+long,
                        "item_url": "http:\/\/maps.apple.com\/maps?q="+lat+","+long+"&z=16"
                    }
                }
            }
        }
    }
}
Cevap 07/07/2016 saat 13:30
kaynak kullanıcı

oy
3

Dmitry, hack için teşekkürler! FB API hafifçe burada yük bölümünde benim için çalıştı ne değişti:

    payload = dict()
    payload['type'] = 'template'
    payload['text'] = dict(
        template_type="generic",
        elements=[
            dict(
                title='{venue} location',
                # subtitle='Test',
                image_url="https://maps.googleapis.com/maps/api/staticmap?size=764x400&center=" + lat + "," + long +
                          "&zoom=15&markers=" + lat + "," + long,  
                default_action=dict(
                    type="web_url",
                    url="http://maps.apple.com/maps?q=" + venue + "&ll=" + lat + "," + long +
                        "&z=15"
                )
            )  # buttons=[])
        ]
    )
Cevap 21/03/2017 saat 10:47
kaynak kullanıcı

Cookies help us deliver our services. By using our services, you agree to our use of cookies. Learn more